convert "suspend deliver" button into a toggle

This commit is contained in:
Hazelnoot 2024-10-10 19:03:46 -04:00
parent eb2ea85d40
commit 87a12c020f

View file

@ -46,9 +46,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_buttons">
<MkButton inline :disabled="!instance" danger @click="deleteAllFiles">{{ i18n.ts.deleteAllFiles }}</MkButton>
<MkButton inline :disabled="!instance" danger @click="severAllFollowRelations">{{ i18n.ts.severAllFollowRelations }}</MkButton>
<MkButton v-if="suspensionState === 'none'" inline :disabled="!instance" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton>
<MkButton v-if="suspensionState !== 'none'" inline :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</MkButton>
</div>
<MkSwitch v-model="isSuspended" :disabled="!instance">{{ i18n.ts._delivery.stop }}</MkSwitch>
<MkInfo v-if="isBaseBlocked" warn>{{ i18n.ts.blockedByBase }}</MkInfo>
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance || isBaseBlocked" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
<MkInfo v-if="isBaseSilenced" warn>{{ i18n.ts.silencedByBase }}</MkInfo>
@ -214,6 +213,11 @@ const isMediaSilenced = ref(false);
const faviconUrl = ref<string | null>(null);
const moderationNote = ref('');
const isSuspended = computed({
get: () => suspensionState.value !== 'none',
set: value => value ? stopDelivery() : resumeDelivery(),
});
const baseDomains = computed(() => {
const domains: string[] = [];