refactor: 🚩 post editing is no longer experimental

This commit is contained in:
ThatOneCalculator 2023-07-01 20:00:51 -07:00
parent f6009dc6e8
commit 66b61bb41b
14 changed files with 4 additions and 53 deletions

View file

@ -2082,11 +2082,7 @@ _experiments:
alpha: Alfa alpha: Alfa
beta: Beta beta: Beta
release: Publicà release: Publicà
enablePostEditing: Activà l'edició de publicacions
title: Experiments title: Experiments
postEditingCaption: Mostra l'opció perquè els usuaris editin les seves publicacions
mitjançant el menú d'opcions de publicació, i permet rebre publicacions editades
d'altres servidors.
enablePostImports: Activar l'importació de publicacions enablePostImports: Activar l'importació de publicacions
postImportsCaption: Permet els usuaris importar publicacions desde comptes a Calckey, postImportsCaption: Permet els usuaris importar publicacions desde comptes a Calckey,
Misskey, Mastodon, Akkoma i Pleroma. Pot fer que el servidor vagi més lent durant Misskey, Mastodon, Akkoma i Pleroma. Pot fer que el servidor vagi més lent durant

View file

@ -2095,10 +2095,7 @@ jumpToPrevious: Zum Vorherigen springen
silencedWarning: Diese Meldung wird angezeigt, weil diese Nutzer von Servern stammen, silencedWarning: Diese Meldung wird angezeigt, weil diese Nutzer von Servern stammen,
die Ihr Administrator abgeschaltet hat, so dass es sich möglicherweise um Spam handelt. die Ihr Administrator abgeschaltet hat, so dass es sich möglicherweise um Spam handelt.
_experiments: _experiments:
enablePostEditing: Beitragsbearbeitung ermöglichen
title: Funktionstests title: Funktionstests
postEditingCaption: Zeigt die Option für Nutzer an, ihre bestehenden Beiträge über
das Menü "Beitragsoptionen" zu bearbeiten
enablePostImports: Beitragsimporte aktivieren enablePostImports: Beitragsimporte aktivieren
postImportsCaption: Erlaubt es Nutzer:innen ihre Posts von alten Calckey, Misskey, postImportsCaption: Erlaubt es Nutzer:innen ihre Posts von alten Calckey, Misskey,
Mastodon, Akkoma und Pleroma Accounts zu importieren. Bei Engpässen in der Warteschlange Mastodon, Akkoma und Pleroma Accounts zu importieren. Bei Engpässen in der Warteschlange

View file

@ -2070,9 +2070,6 @@ _deck:
direct: "Direct messages" direct: "Direct messages"
_experiments: _experiments:
title: "Experiments" title: "Experiments"
enablePostEditing: "Enable post editing"
postEditingCaption: "Shows the option for users to edit their existing posts via\
\ the post options menu, and allows post edits from other instances to be recieved."
enablePostImports: "Enable post imports" enablePostImports: "Enable post imports"
postImportsCaption: "Allows users to import their posts from past Calckey,\ postImportsCaption: "Allows users to import their posts from past Calckey,\
\ Misskey, Mastodon, Akkoma, and Pleroma accounts. It may cause slowdowns during\ \ Misskey, Mastodon, Akkoma, and Pleroma accounts. It may cause slowdowns during\

View file

@ -2028,7 +2028,7 @@ flagShowTimelineRepliesDescription: Si activé, affiche dans le fil les réponse
_experiments: _experiments:
alpha: Alpha alpha: Alpha
beta: Beta beta: Beta
enablePostEditing: Autoriser l'édition de note enablePostImports: Autoriser l'importation de messages
title: Expérimentations title: Expérimentations
findOtherInstance: Trouver un autre serveur findOtherInstance: Trouver un autre serveur
userSaysSomethingReasonQuote: '{name} a cité une note contenant {reason}' userSaysSomethingReasonQuote: '{name} a cité une note contenant {reason}'

View file

@ -1887,9 +1887,7 @@ hiddenTagsDescription: 'トレンドと「みつける」から除外したい
hiddenTags: 非表示にするハッシュタグ hiddenTags: 非表示にするハッシュタグ
apps: "アプリ" apps: "アプリ"
_experiments: _experiments:
enablePostEditing: 投稿の編集機能を有効にする
title: 試験的な機能 title: 試験的な機能
postEditingCaption: 投稿のメニューに既存の投稿を編集するボタンを表示し、他サーバーの編集も受信できるようにします。
postImportsCaption: postImportsCaption:
ユーザーが過去の投稿をCalckey・Misskey・Mastodon・Akkoma・Pleromaからインポートすることを許可します。キューが溜まっているときにインポートするとサーバーに負荷がかかる可能性があります。 ユーザーが過去の投稿をCalckey・Misskey・Mastodon・Akkoma・Pleromaからインポートすることを許可します。キューが溜まっているときにインポートするとサーバーに負荷がかかる可能性があります。
enablePostImports: 投稿のインポートを有効にする enablePostImports: 投稿のインポートを有効にする

View file

@ -1816,7 +1816,6 @@ silenceThisInstance: 靜音此伺服器
silencedInstances: 已靜音的伺服器 silencedInstances: 已靜音的伺服器
silenced: 已靜音 silenced: 已靜音
_experiments: _experiments:
enablePostEditing: 啟用帖子編輯
title: 試驗功能 title: 試驗功能
findOtherInstance: 找找另一個伺服器 findOtherInstance: 找找另一個伺服器
noGraze: 瀏覽器擴展 "Graze for Mastodon" 會與Calckey發生衝突請停用該擴展。 noGraze: 瀏覽器擴展 "Graze for Mastodon" 會與Calckey發生衝突請停用該擴展。

View file

@ -541,10 +541,6 @@ function notEmpty(partial: Partial<any>) {
export async function updateNote(value: string | IObject, resolver?: Resolver) { export async function updateNote(value: string | IObject, resolver?: Resolver) {
const uri = typeof value === "string" ? value : value.id; const uri = typeof value === "string" ? value : value.id;
if (!uri) throw new Error("Missing note uri"); if (!uri) throw new Error("Missing note uri");
const instanceMeta = await fetchMeta();
if (instanceMeta.experimentalFeatures?.postEdits === false) {
throw new Error("Post edits disabled.");
}
// Skip if URI points to this server // Skip if URI points to this server
if (uri.startsWith(`${config.url}/`)) throw new Error("uri points local"); if (uri.startsWith(`${config.url}/`)) throw new Error("uri points local");

View file

@ -476,9 +476,6 @@ export const meta = {
optional: true, optional: true,
nullable: true, nullable: true,
properties: { properties: {
postEditing: {
type: "boolean",
},
postImports: { postImports: {
type: "boolean", type: "boolean",
}, },

View file

@ -174,7 +174,6 @@ export const paramDef = {
type: "object", type: "object",
nullable: true, nullable: true,
properties: { properties: {
postEditing: { type: "boolean" },
postImports: { type: "boolean" }, postImports: { type: "boolean" },
}, },
}, },

View file

@ -529,7 +529,7 @@ export default define(meta, paramDef, async (ps, me) => {
github: instance.enableGithubIntegration, github: instance.enableGithubIntegration,
discord: instance.enableDiscordIntegration, discord: instance.enableDiscordIntegration,
serviceWorker: instance.enableServiceWorker, serviceWorker: instance.enableServiceWorker,
postEditing: instance.experimentalFeatures?.postEditing || false, postEditing: true,
postImports: instance.experimentalFeatures?.postImports || false, postImports: instance.experimentalFeatures?.postImports || false,
miauth: true, miauth: true,
}; };

View file

@ -140,12 +140,6 @@ export const meta = {
code: "NOT_LOCAL_USER", code: "NOT_LOCAL_USER",
id: "b907f407-2aa0-4283-800b-a2c56290b822", id: "b907f407-2aa0-4283-800b-a2c56290b822",
}, },
editsDisabled: {
message: "Post edits are disabled.",
code: "EDITS_DISABLED",
id: "99306f00-fb81-11ed-be56-0242ac120002",
},
}, },
} as const; } as const;
@ -244,11 +238,6 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
if (user.movedToUri != null) throw new ApiError(meta.errors.accountLocked); if (user.movedToUri != null) throw new ApiError(meta.errors.accountLocked);
const instanceMeta = await fetchMeta();
if (instanceMeta.experimentalFeatures?.postEdits === false) {
throw new ApiError(meta.errors.editsDisabled);
}
if (!Users.isLocalUser(user)) { if (!Users.isLocalUser(user)) {
throw new ApiError(meta.errors.notLocalUser); throw new ApiError(meta.errors.notLocalUser);
} }

View file

@ -83,7 +83,7 @@ const nodeinfo2 = async () => {
disableGlobalTimeline: meta.disableGlobalTimeline, disableGlobalTimeline: meta.disableGlobalTimeline,
emailRequiredForSignup: meta.emailRequiredForSignup, emailRequiredForSignup: meta.emailRequiredForSignup,
searchFilters: config.meilisearch ? true : false, searchFilters: config.meilisearch ? true : false,
postEditing: meta.experimentalFeatures?.postEditing || false, postEditing: true,
postImports: meta.experimentalFeatures?.postImports || false, postImports: meta.experimentalFeatures?.postImports || false,
enableHcaptcha: meta.enableHcaptcha, enableHcaptcha: meta.enableHcaptcha,
enableRecaptcha: meta.enableRecaptcha, enableRecaptcha: meta.enableRecaptcha,

View file

@ -8,19 +8,6 @@
/></template> /></template>
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32"> <MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
<FormSuspense :p="init"> <FormSuspense :p="init">
<FormSwitch
v-model="enablePostEditing"
@update:modelValue="save"
class="_formBlock"
>
<template #label>
<i class="ph-pencil-line ph-bold ph-lg"></i>
{{ i18n.ts._experiments.enablePostEditing }}
</template>
<template #caption>{{
i18n.ts._experiments.postEditingCaption
}}</template>
</FormSwitch>
<FormSwitch <FormSwitch
v-model="enablePostImports" v-model="enablePostImports"
@update:modelValue="save" @update:modelValue="save"
@ -49,13 +36,11 @@ import { fetchInstance } from "@/instance";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
let enablePostEditing = $ref(false);
let enablePostImports = $ref(false); let enablePostImports = $ref(false);
let meta = $ref<MetaExperiments | null>(null); let meta = $ref<MetaExperiments | null>(null);
type MetaExperiments = { type MetaExperiments = {
experimentalFeatures?: { experimentalFeatures?: {
postEditing?: boolean;
postImports?: boolean; postImports?: boolean;
}; };
}; };
@ -64,14 +49,12 @@ async function init() {
meta = (await os.api("admin/meta")) as MetaExperiments; meta = (await os.api("admin/meta")) as MetaExperiments;
if (!meta) return; if (!meta) return;
enablePostEditing = meta.experimentalFeatures?.postEditing ?? false;
enablePostImports = meta.experimentalFeatures?.postImports ?? false; enablePostImports = meta.experimentalFeatures?.postImports ?? false;
} }
function save() { function save() {
const experiments: MetaExperiments = { const experiments: MetaExperiments = {
experimentalFeatures: { experimentalFeatures: {
postEditing: enablePostEditing,
postImports: enablePostImports, postImports: enablePostImports,
}, },
}; };

View file

@ -408,7 +408,7 @@ export function getNoteMenu(props: {
}, },
} }
: undefined, : undefined,
instance.features.postEditing && isAppearAuthor isAppearAuthor
? { ? {
icon: "ph-pencil-line ph-bold ph-lg", icon: "ph-pencil-line ph-bold ph-lg",
text: i18n.ts.edit, text: i18n.ts.edit,