fix saving moderation note

This commit is contained in:
Hazelnoot 2025-05-29 23:55:40 -04:00
parent f799835ec7
commit 92bbcd3255

View file

@ -98,7 +98,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkFolder v-if="iAmModerator" :defaultOpen="moderationNote.length > 0" :sticky="false"> <MkFolder v-if="iAmModerator" :defaultOpen="moderationNote.length > 0" :sticky="false">
<template #icon><i class="ph-stamp ph-bold ph-lg"></i></template> <template #icon><i class="ph-stamp ph-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.moderationNote }}</template> <template #label>{{ i18n.ts.moderationNote }}</template>
<MkTextarea v-model="moderationNote" manualSave> <MkTextarea v-model="moderationNote" manualSave @update:modelValue="saveModerationNote">
<template #label>{{ i18n.ts.moderationNote }}</template> <template #label>{{ i18n.ts.moderationNote }}</template>
<template #caption>{{ i18n.ts.moderationNoteDescription }}</template> <template #caption>{{ i18n.ts.moderationNoteDescription }}</template>
</MkTextarea> </MkTextarea>
@ -353,12 +353,15 @@ const followersPagination = {
offsetMode: false, offsetMode: false,
}; };
async function saveModerationNote() {
if (iAmModerator) { if (iAmModerator) {
watch(moderationNote, async () => { await os.promiseDialog(async () => {
if (instance.value == null) return; if (instance.value == null) return;
await os.apiWithDialog('admin/federation/update-instance', { host: instance.value.host, moderationNote: moderationNote.value }); await os.apiWithDialog('admin/federation/update-instance', { host: instance.value.host, moderationNote: moderationNote.value });
await fetch();
}); });
} }
}
async function fetch(): Promise<void> { async function fetch(): Promise<void> {
const [m, i] = await Promise.all([ const [m, i] = await Promise.all([