feat(frontend/channel-editor): support isSensitive in create/edit channel page

This commit is contained in:
anatawa12 2023-07-31 15:40:16 +09:00
parent 11593a76b0
commit fb91b8cb95
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
1 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,10 @@
<template #label>{{ i18n.ts.color }}</template> <template #label>{{ i18n.ts.color }}</template>
</MkColorInput> </MkColorInput>
<MkSwitch v-model="isSensitive">
<template #label>{{ i18n.ts.sensitive }}</template>
</MkSwitch>
<div> <div>
<MkButton v-if="bannerId == null" @click="setBannerImage"><i class="ti ti-plus"></i> {{ i18n.ts._channel.setBanner }}</MkButton> <MkButton v-if="bannerId == null" @click="setBannerImage"><i class="ti ti-plus"></i> {{ i18n.ts._channel.setBanner }}</MkButton>
<div v-else-if="bannerUrl"> <div v-else-if="bannerUrl">
@ -67,6 +71,7 @@ import { useRouter } from '@/router';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
import MkSwitch from "@/components/MkSwitch.vue";
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default)); const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
@ -82,6 +87,7 @@ let description = $ref(null);
let bannerUrl = $ref<string | null>(null); let bannerUrl = $ref<string | null>(null);
let bannerId = $ref<string | null>(null); let bannerId = $ref<string | null>(null);
let color = $ref('#000'); let color = $ref('#000');
let isSensitive = $ref(false);
const pinnedNotes = ref([]); const pinnedNotes = ref([]);
watch(() => bannerId, async () => { watch(() => bannerId, async () => {
@ -105,6 +111,7 @@ async function fetchChannel() {
description = channel.description; description = channel.description;
bannerId = channel.bannerId; bannerId = channel.bannerId;
bannerUrl = channel.bannerUrl; bannerUrl = channel.bannerUrl;
isSensitive = channel.isSensitive;
pinnedNotes.value = channel.pinnedNoteIds.map(id => ({ pinnedNotes.value = channel.pinnedNoteIds.map(id => ({
id, id,
})); }));
@ -137,6 +144,7 @@ function save() {
bannerId: bannerId, bannerId: bannerId,
pinnedNoteIds: pinnedNotes.value.map(x => x.id), pinnedNoteIds: pinnedNotes.value.map(x => x.id),
color: color, color: color,
isSensitive: isSensitive,
}; };
if (props.channelId) { if (props.channelId) {