feat: add "re:" at the beginning of CW reply comment (close #52)

This commit is contained in:
naskya 2023-07-21 13:48:27 +00:00 committed by ThatOneCalculator
parent 226a419461
commit 055bec56c7
No known key found for this signature in database
GPG key ID: 8703CACD01000000
5 changed files with 27 additions and 1 deletions

View file

@ -1134,6 +1134,7 @@ deletePasskeys: "Delete passkeys"
delete2faConfirm: "This will irreversibly delete 2FA on this account. Proceed?" delete2faConfirm: "This will irreversibly delete 2FA on this account. Proceed?"
deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?" deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?"
inputNotMatch: "Input does not match" inputNotMatch: "Input does not match"
addRe: "Add \"re:\" at the beginning of comment in reply to a post with a content warning"
_sensitiveMediaDetection: _sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing description: "Reduces the effort of server moderation through automatically recognizing

View file

@ -987,6 +987,7 @@ showWithSparkles: "タイトルをキラキラさせる"
youHaveUnreadAnnouncements: "未読のお知らせがあります" youHaveUnreadAnnouncements: "未読のお知らせがあります"
neverShow: "今後表示しない" neverShow: "今後表示しない"
remindMeLater: "また後で" remindMeLater: "また後で"
addRe: "閲覧注意の投稿への返信で、注釈の先頭に\"re:\"を追加する"
_sensitiveMediaDetection: _sensitiveMediaDetection:
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。" description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。"

View file

@ -519,10 +519,23 @@ if (props.specified) {
pushVisibleUser(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 // keep cw when reply
if (defaultStore.state.keepCw && props.reply && props.reply.cw) { if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
useCw = true; useCw = true;
cw = props.reply.cw; cw =
props.reply.user.username === $i.username
? props.reply.cw
: addRe(props.reply.cw);
} }
function watchForDraft() { function watchForDraft() {

View file

@ -71,6 +71,12 @@
{{ i18n.ts.reflectMayTakeTime }}</template {{ i18n.ts.reflectMayTakeTime }}</template
></FormSwitch ></FormSwitch
> >
<FormSwitch v-model="addRe" class="_formBlock"
>{{ i18n.ts.addRe
}}<span class="_beta">{{
i18n.ts.originalFeature
}}</span></FormSwitch
>
<FormSelect v-model="serverDisconnectedBehavior" class="_formBlock"> <FormSelect v-model="serverDisconnectedBehavior" class="_formBlock">
<template #label>{{ i18n.ts.whenServerDisconnected }}</template> <template #label>{{ i18n.ts.whenServerDisconnected }}</template>
@ -357,6 +363,7 @@ const showAdminUpdates = computed(
const showTimelineReplies = computed( const showTimelineReplies = computed(
defaultStore.makeGetterSetter("showTimelineReplies"), defaultStore.makeGetterSetter("showTimelineReplies"),
); );
const addRe = computed(defaultStore.makeGetterSetter("addRe"));
watch(swipeOnDesktop, () => { watch(swipeOnDesktop, () => {
defaultStore.set("swipeOnMobile", true); defaultStore.set("swipeOnMobile", true);

View file

@ -342,6 +342,10 @@ export const defaultStore = markRaw(
where: "device", where: "device",
default: false, default: false,
}, },
addRe: {
where: "account",
default: true,
},
}), }),
); );