feat: チャンネルの削除

Resolve #7171
Resolve #9935
This commit is contained in:
syuilo
2023-05-06 08:15:17 +09:00
parent 3a105024c7
commit 5dfbce7571
13 changed files with 60 additions and 4 deletions

View File

@@ -46,8 +46,9 @@
</div>
</MkFolder>
<div>
<div class="_buttons">
<MkButton primary @click="save()"><i class="ti ti-device-floppy"></i> {{ channelId ? i18n.ts.save : i18n.ts.create }}</MkButton>
<MkButton v-if="channelId" danger @click="archive()"><i class="ti ti-trash"></i> {{ i18n.ts.archive }}</MkButton>
</div>
</div>
</MkSpacer>
@@ -151,6 +152,23 @@ function save() {
}
}
async function archive() {
const { canceled } = await os.confirm({
type: 'warning',
title: i18n.t('channelArchiveConfirmTitle', { name: name }),
text: i18n.ts.channelArchiveConfirmDescription,
});
if (canceled) return;
os.api('channels/update', {
channelId: props.channelId,
isArchived: true,
}).then(() => {
os.success();
});
}
function setBannerImage(evt) {
selectFile(evt.currentTarget ?? evt.target, null).then(file => {
bannerId = file.id;

View File

@@ -28,6 +28,8 @@
</MkFoldableSection>
</div>
<div v-if="channel && tab === 'timeline'" class="_gaps">
<MkInfo v-if="channel.isArchived" warn>{{ i18n.ts.thisChannelArchived }}</MkInfo>
<!-- スマホタブレットの場合キーボードが表示されると投稿が見づらくなるのでデスクトップ場合のみ自動でフォーカスを当てる -->
<MkPostForm v-if="$i && defaultStore.reactiveState.showFixedPostFormInChannel.value" :channel="channel" class="post-form _panel" fixed :autofocus="deviceKind === 'desktop'"/>
@@ -77,6 +79,7 @@ import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import { defaultStore } from '@/store';
import MkNote from '@/components/MkNote.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
const router = useRouter();