From d9af4f3a2737f32b054131aad4818e6659894e01 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sat, 1 Jul 2023 20:00:51 -0700 Subject: [PATCH] refactor: :triangular_flag_on_post: post editing is no longer experimental --- locales/ca-ES.yml | 4 ---- locales/de-DE.yml | 3 --- locales/en-US.yml | 3 --- locales/fr-FR.yml | 2 +- locales/ja-JP.yml | 2 -- locales/zh-TW.yml | 1 - .../src/remote/activitypub/models/note.ts | 4 ---- .../src/server/api/endpoints/admin/meta.ts | 3 --- .../server/api/endpoints/admin/update-meta.ts | 1 - .../backend/src/server/api/endpoints/meta.ts | 2 +- .../src/server/api/endpoints/notes/edit.ts | 11 ----------- packages/backend/src/server/nodeinfo.ts | 2 +- packages/client/src/pages/admin/experiments.vue | 17 ----------------- packages/client/src/scripts/get-note-menu.ts | 2 +- 14 files changed, 4 insertions(+), 53 deletions(-) diff --git a/locales/ca-ES.yml b/locales/ca-ES.yml index 208ccb159..e482750f4 100644 --- a/locales/ca-ES.yml +++ b/locales/ca-ES.yml @@ -2082,11 +2082,7 @@ _experiments: alpha: Alfa beta: Beta release: Publicà - enablePostEditing: Activà l'edició de publicacions 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 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 diff --git a/locales/de-DE.yml b/locales/de-DE.yml index d37869064..e9e33d6d6 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -2095,10 +2095,7 @@ jumpToPrevious: Zum Vorherigen springen 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. _experiments: - enablePostEditing: Beitragsbearbeitung ermöglichen title: Funktionstests - postEditingCaption: Zeigt die Option für Nutzer an, ihre bestehenden Beiträge über - das Menü "Beitragsoptionen" zu bearbeiten enablePostImports: Beitragsimporte aktivieren postImportsCaption: Erlaubt es Nutzer:innen ihre Posts von alten Calckey, Misskey, Mastodon, Akkoma und Pleroma Accounts zu importieren. Bei Engpässen in der Warteschlange diff --git a/locales/en-US.yml b/locales/en-US.yml index 5daff11a9..d493f332f 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2070,9 +2070,6 @@ _deck: direct: "Direct messages" _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" postImportsCaption: "Allows users to import their posts from past Calckey,\ \ Misskey, Mastodon, Akkoma, and Pleroma accounts. It may cause slowdowns during\ diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index 5a61870c4..5291d1693 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -2028,7 +2028,7 @@ flagShowTimelineRepliesDescription: Si activé, affiche dans le fil les réponse _experiments: alpha: Alpha beta: Beta - enablePostEditing: Autoriser l'édition de note + enablePostImports: Autoriser l'importation de messages title: Expérimentations findOtherInstance: Trouver un autre serveur userSaysSomethingReasonQuote: '{name} a cité une note contenant {reason}' diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 21f616808..fa3c3f1cc 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1887,9 +1887,7 @@ hiddenTagsDescription: 'トレンドと「みつける」から除外したい hiddenTags: 非表示にするハッシュタグ apps: "アプリ" _experiments: - enablePostEditing: 投稿の編集機能を有効にする title: 試験的な機能 - postEditingCaption: 投稿のメニューに既存の投稿を編集するボタンを表示し、他サーバーの編集も受信できるようにします。 postImportsCaption: ユーザーが過去の投稿をCalckey・Misskey・Mastodon・Akkoma・Pleromaからインポートすることを許可します。キューが溜まっているときにインポートするとサーバーに負荷がかかる可能性があります。 enablePostImports: 投稿のインポートを有効にする diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index d373daf5d..c615bcdcc 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -1816,7 +1816,6 @@ silenceThisInstance: 靜音此伺服器 silencedInstances: 已靜音的伺服器 silenced: 已靜音 _experiments: - enablePostEditing: 啟用帖子編輯 title: 試驗功能 findOtherInstance: 找找另一個伺服器 noGraze: 瀏覽器擴展 "Graze for Mastodon" 會與Calckey發生衝突,請停用該擴展。 diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index 26aa5bf54..a3141e388 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -541,10 +541,6 @@ function notEmpty(partial: Partial) { export async function updateNote(value: string | IObject, resolver?: Resolver) { const uri = typeof value === "string" ? value : value.id; 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 if (uri.startsWith(`${config.url}/`)) throw new Error("uri points local"); diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index ad7031063..319330127 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -476,9 +476,6 @@ export const meta = { optional: true, nullable: true, properties: { - postEditing: { - type: "boolean", - }, postImports: { type: "boolean", }, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index b967112a5..cf22c6c48 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -174,7 +174,6 @@ export const paramDef = { type: "object", nullable: true, properties: { - postEditing: { type: "boolean" }, postImports: { type: "boolean" }, }, }, diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index f6c978b2d..673a0266c 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -529,7 +529,7 @@ export default define(meta, paramDef, async (ps, me) => { github: instance.enableGithubIntegration, discord: instance.enableDiscordIntegration, serviceWorker: instance.enableServiceWorker, - postEditing: instance.experimentalFeatures?.postEditing || false, + postEditing: true, postImports: instance.experimentalFeatures?.postImports || false, miauth: true, }; diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index 14ce2faaf..70c5ceffb 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -140,12 +140,6 @@ export const meta = { code: "NOT_LOCAL_USER", id: "b907f407-2aa0-4283-800b-a2c56290b822", }, - - editsDisabled: { - message: "Post edits are disabled.", - code: "EDITS_DISABLED", - id: "99306f00-fb81-11ed-be56-0242ac120002", - }, }, } as const; @@ -244,11 +238,6 @@ export const paramDef = { export default define(meta, paramDef, async (ps, user) => { 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)) { throw new ApiError(meta.errors.notLocalUser); } diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 18e04f420..dbfb28ff6 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -83,7 +83,7 @@ const nodeinfo2 = async () => { disableGlobalTimeline: meta.disableGlobalTimeline, emailRequiredForSignup: meta.emailRequiredForSignup, searchFilters: config.meilisearch ? true : false, - postEditing: meta.experimentalFeatures?.postEditing || false, + postEditing: true, postImports: meta.experimentalFeatures?.postImports || false, enableHcaptcha: meta.enableHcaptcha, enableRecaptcha: meta.enableRecaptcha, diff --git a/packages/client/src/pages/admin/experiments.vue b/packages/client/src/pages/admin/experiments.vue index 0c9a258cb..32ce9bfae 100644 --- a/packages/client/src/pages/admin/experiments.vue +++ b/packages/client/src/pages/admin/experiments.vue @@ -8,19 +8,6 @@ /> - - - - (null); type MetaExperiments = { experimentalFeatures?: { - postEditing?: boolean; postImports?: boolean; }; }; @@ -64,14 +49,12 @@ async function init() { meta = (await os.api("admin/meta")) as MetaExperiments; if (!meta) return; - enablePostEditing = meta.experimentalFeatures?.postEditing ?? false; enablePostImports = meta.experimentalFeatures?.postImports ?? false; } function save() { const experiments: MetaExperiments = { experimentalFeatures: { - postEditing: enablePostEditing, postImports: enablePostImports, }, }; diff --git a/packages/client/src/scripts/get-note-menu.ts b/packages/client/src/scripts/get-note-menu.ts index fa78c7ce5..75565a1ac 100644 --- a/packages/client/src/scripts/get-note-menu.ts +++ b/packages/client/src/scripts/get-note-menu.ts @@ -408,7 +408,7 @@ export function getNoteMenu(props: { }, } : undefined, - instance.features.postEditing && isAppearAuthor + isAppearAuthor ? { icon: "ph-pencil-line ph-bold ph-lg", text: i18n.ts.edit,