diff --git a/README.md b/README.md index f633f9c6e..64f576f1b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ ## 細かい変更点 +- 閲覧注意の投稿への返信で注釈の先頭に "re:" をつける設定を追加 + - 返信で閲覧注意は維持したいけどそのままの注釈を用いるのには違和感を覚えることがよくあるため - NSFW メディアを隠す設定をブラウザごとの設定からブラウザごとかつアカウントごとの設定に変更 - 「このアカウントでは NSFW の画像を常に表示したい」みたいな需要が私にあったため - インスタンスティッカーをデフォルトで常に表示する diff --git a/locales/en-US.yml b/locales/en-US.yml index 676f94dff..cf55d4260 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1132,6 +1132,7 @@ hideFollowButtons: "Hide follow buttons in notifications and user pages" forMobile: "Mobile" replaceChatButtonWithAccountButton: "Replace chat button at the bottom with account switch button" replaceWidgetsButtonWithReloadButton: "Replace widgets button at the bottom with reload button" +addRe: "Add \"re:\" at the beginning of comment in reply to CW'd post" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e9a49e1e2..b89f741ff 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -992,6 +992,7 @@ hideFollowButtons: "新規フォロワーの通知とユーザーページの .. forMobile: "モバイル向け" replaceChatButtonWithAccountButton: "画面下部のチャットのボタンをアカウント切り替えボタンに変更する" replaceWidgetsButtonWithReloadButton: "画面下部のウィジェットのボタンを再読み込みボタンに変更する" +addRe: "閲覧注意の投稿への返信で、注釈の先頭に\"re:\"を追加する" _sensitiveMediaDetection: description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。" diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index 79c31bccd..df348ba3f 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -518,10 +518,23 @@ if (props.specified) { pushVisibleUser(props.specified); } +const addRe = (s: string) => { + if ( + !defaultStore.state.addRe || + s.trim() === "" || + s.slice(0, 3).toLowerCase() === "re:" + ) + return s; + return `re: ${s}`; +}; + // keep cw when reply if (defaultStore.state.keepCw && props.reply && props.reply.cw) { useCw = true; - cw = props.reply.cw; + cw = + props.reply.user.username === $i.username + ? props.reply.cw + : addRe(props.reply.cw); } function watchForDraft() { diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index e3a25ddfc..9b8329059 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -77,6 +77,12 @@ {{ i18n.ts.reflectMayTakeTime }} + {{ i18n.ts.addRe + }}{{ + i18n.ts.originalFeature + }} @@ -405,6 +411,7 @@ const replaceChatButtonWithAccountButton = computed( const replaceWidgetsButtonWithReloadButton = computed( defaultStore.makeGetterSetter("replaceWidgetsButtonWithReloadButton"), ); +const addRe = computed(defaultStore.makeGetterSetter("addRe")); watch(swipeOnDesktop, () => { defaultStore.set("swipeOnMobile", true); diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index 6aeaca646..af45f7b57 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -358,6 +358,10 @@ export const defaultStore = markRaw( where: "device", default: true, }, + addRe: { + where: "account", + default: true, + }, }), );