Merge branch 'develop' into feature/approval

This commit is contained in:
Marie 2023-10-18 05:40:32 +02:00 committed by GitHub
commit 182bf7e7d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 121 additions and 0 deletions

View file

@ -79,6 +79,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<FormSection>
<div class="_gaps">
<MkSwitch v-model="suspended" @update:modelValue="toggleSuspend">{{ i18n.ts.suspend }}</MkSwitch>
<MkSwitch v-model="markedAsNSFW" @update:modelValue="toggleNSFW">{{ i18n.ts.markAsNSFW }}</MkSwitch>
<div>
<MkButton v-if="user.host == null" inline style="margin-right: 8px;" @click="resetPassword"><i class="ph-key ph-bold ph-lg"></i> {{ i18n.ts.resetPassword }}</MkButton>
@ -240,6 +241,7 @@ let moderator = $ref(false);
let silenced = $ref(false);
let approved = $ref(false);
let suspended = $ref(false);
let markedAsNSFW = $ref(false);
let moderationNote = $ref('');
let signupReason = $ref('');
@ -276,6 +278,7 @@ function createFetcher() {
suspended = info.isSuspended;
moderationNote = info.moderationNote;
signupReason = info.signupReason;
markedAsNSFW = info.alwaysMarkNsfw;
watch($$(moderationNote), async () => {
await os.api('admin/update-user-note', { userId: user.id, text: moderationNote });
@ -311,6 +314,19 @@ async function resetPassword() {
}
}
async function toggleNSFW(v) {
const confirm = await os.confirm({
type: 'warning',
text: v ? i18n.ts.nsfwConfirm : i18n.ts.unNsfwConfirm,
});
if (confirm.canceled) {
markedAsNSFW = !v;
} else {
await os.api(v ? 'admin/nsfw-user' : 'admin/unnsfw-user', { userId: user.id });
await refreshUser();
}
}
async function toggleSuspend(v) {
const confirm = await os.confirm({
type: 'warning',