2021-12-09 05:38:56 -07:00
|
|
|
<template>
|
2021-12-09 05:45:14 -07:00
|
|
|
<div class="_formRoot">
|
2022-04-30 20:52:19 -06:00
|
|
|
<MkInfo>{{ i18n.ts._instanceMute.title }}</MkInfo>
|
2021-12-09 05:45:14 -07:00
|
|
|
<FormTextarea v-model="instanceMutes" class="_formBlock">
|
2022-04-30 20:52:19 -06:00
|
|
|
<template #label>{{ i18n.ts._instanceMute.heading }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._instanceMute.instanceMuteDescription }}<br>{{ i18n.ts._instanceMute.instanceMuteDescription2 }}</template>
|
2021-12-09 05:45:14 -07:00
|
|
|
</FormTextarea>
|
2022-04-30 20:52:19 -06:00
|
|
|
<MkButton primary :disabled="!changed" class="_formBlock" @click="save()"><i class="fas fa-save"></i> {{ i18n.ts.save }}</MkButton>
|
2021-12-09 05:45:14 -07:00
|
|
|
</div>
|
2021-12-09 05:38:56 -07:00
|
|
|
</template>
|
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { defineExpose, ref, watch } from 'vue';
|
2021-12-09 05:45:14 -07:00
|
|
|
import FormTextarea from '@/components/form/textarea.vue';
|
|
|
|
import MkInfo from '@/components/ui/info.vue';
|
|
|
|
import MkButton from '@/components/ui/button.vue';
|
2021-12-09 05:38:56 -07:00
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
2022-04-30 20:52:19 -06:00
|
|
|
import { $i } from '@/account';
|
|
|
|
import { i18n } from '@/i18n';
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
const instanceMutes = ref($i!.mutedInstances.join('\n'));
|
|
|
|
const changed = ref(false);
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
async function save() {
|
|
|
|
let mutes = instanceMutes.value
|
|
|
|
.trim().split('\n')
|
|
|
|
.map(el => el.trim())
|
|
|
|
.filter(el => el);
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
await os.api('i/update', {
|
|
|
|
mutedInstances: mutes,
|
|
|
|
});
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
changed.value = false;
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
// Refresh filtered list to signal to the user how they've been saved
|
|
|
|
instanceMutes.value = mutes.join('\n');
|
|
|
|
}
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
watch(instanceMutes, () => {
|
|
|
|
changed.value = true;
|
|
|
|
});
|
2021-12-09 05:38:56 -07:00
|
|
|
|
2022-04-30 20:52:19 -06:00
|
|
|
defineExpose({
|
|
|
|
[symbols.PAGE_INFO]: {
|
|
|
|
title: i18n.ts.instanceMute,
|
|
|
|
icon: 'fas fa-volume-mute'
|
2021-12-09 05:38:56 -07:00
|
|
|
}
|
2022-04-30 20:52:19 -06:00
|
|
|
});
|
2021-12-09 05:38:56 -07:00
|
|
|
</script>
|