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?"
deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?"
inputNotMatch: "Input does not match"
addRe: "Add \"re:\" at the beginning of comment in reply to a post with a content warning"
_sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing

View File

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

View File

@ -519,10 +519,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() {

View File

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

View File

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