add "reject quotes" toggle at user and instance level

+ improve, cleanup, and de-duplicate quote resolution
+ add warning message when quote cannot be loaded
+ add "process error" framework to display warnings when a note cannot be correctly loaded from another instance
This commit is contained in:
Hazelnoot 2025-02-15 23:08:02 -05:00
parent 93ffd4611c
commit 292d3b9229
36 changed files with 466 additions and 88 deletions

View file

@ -81,6 +81,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps">
<MkSwitch v-model="silenced" @update:modelValue="toggleSilence">{{ i18n.ts.silence }}</MkSwitch>
<MkSwitch v-if="!isSystem" v-model="suspended" @update:modelValue="toggleSuspend">{{ i18n.ts.suspend }}</MkSwitch>
<MkSwitch v-model="rejectQuotes" @update:modelValue="toggleRejectQuotes">{{ i18n.ts.rejectQuotesUser }}</MkSwitch>
<MkSwitch v-model="markedAsNSFW" @update:modelValue="toggleNSFW">{{ i18n.ts.markAsNSFW }}</MkSwitch>
<MkInput v-model="mandatoryCW" type="text" manualSave @update:modelValue="onMandatoryCWChanged">
@ -247,6 +248,7 @@ const moderator = ref(false);
const silenced = ref(false);
const approved = ref(false);
const suspended = ref(false);
const rejectQuotes = ref(false);
const markedAsNSFW = ref(false);
const moderationNote = ref('');
const mandatoryCW = ref<string | null>(null);
@ -287,6 +289,7 @@ function createFetcher() {
approved.value = info.value.approved;
markedAsNSFW.value = info.value.alwaysMarkNsfw;
suspended.value = info.value.isSuspended;
rejectQuotes.value = user.value.rejectQuotes ?? false;
moderationNote.value = info.value.moderationNote;
mandatoryCW.value = user.value.mandatoryCW;
});
@ -368,6 +371,22 @@ async function toggleSuspend(v) {
}
}
async function toggleRejectQuotes(v: boolean): Promise<void> {
const confirm = await os.confirm({
type: 'warning',
text: v ? i18n.ts.rejectQuotesConfirm : i18n.ts.allowQuotesConfirm,
});
if (confirm.canceled) {
rejectQuotes.value = !v;
} else {
await misskeyApi('admin/reject-quotes', {
userId: props.userId,
rejectQuotes: v,
});
await refreshUser();
}
}
async function unsetUserAvatar() {
const confirm = await os.confirm({
type: 'warning',