2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
2021-11-28 20:07:37 +09:00
|
|
|
<div class="_formRoot">
|
2022-05-04 12:25:19 +09:00
|
|
|
<FormLink class="_formBlock" @click="configure"><template #icon><i class="fas fa-cog"></i></template>{{ i18n.ts.notificationSetting }}</FormLink>
|
2021-11-28 20:07:37 +09:00
|
|
|
<FormSection>
|
2022-05-04 12:25:19 +09:00
|
|
|
<FormLink class="_formBlock" @click="readAllNotifications">{{ i18n.ts.markAsReadAllNotifications }}</FormLink>
|
|
|
|
<FormLink class="_formBlock" @click="readAllUnreadNotes">{{ i18n.ts.markAsReadAllUnreadNotes }}</FormLink>
|
|
|
|
<FormLink class="_formBlock" @click="readAllMessagingMessages">{{ i18n.ts.markAsReadAllTalkMessages }}</FormLink>
|
2021-11-28 20:07:37 +09:00
|
|
|
</FormSection>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</template>
|
|
|
|
|
2022-05-13 02:31:26 +09:00
|
|
|
<script lang="ts" setup>
|
2022-06-20 17:38:49 +09:00
|
|
|
import { defineAsyncComponent } from 'vue';
|
|
|
|
import { notificationTypes } from 'misskey-js';
|
2021-11-28 20:07:37 +09:00
|
|
|
import FormButton from '@/components/ui/button.vue';
|
|
|
|
import FormLink from '@/components/form/link.vue';
|
|
|
|
import FormSection from '@/components/form/section.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
2022-05-04 12:25:19 +09:00
|
|
|
import { $i } from '@/account';
|
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-04 12:25:19 +09:00
|
|
|
async function readAllUnreadNotes() {
|
|
|
|
await os.api('i/read-all-unread-notes');
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-04 12:25:19 +09:00
|
|
|
async function readAllMessagingMessages() {
|
|
|
|
await os.api('i/read-all-messaging-messages');
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-04 12:25:19 +09:00
|
|
|
async function readAllNotifications() {
|
|
|
|
await os.api('notifications/mark-all-as-read');
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-05-04 12:25:19 +09:00
|
|
|
function configure() {
|
|
|
|
const includingTypes = notificationTypes.filter(x => !$i!.mutingNotificationTypes.includes(x));
|
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/notification-setting-window.vue')), {
|
|
|
|
includingTypes,
|
|
|
|
showGlobalToggle: false,
|
|
|
|
}, {
|
|
|
|
done: async (res) => {
|
|
|
|
const { includingTypes: value } = res;
|
|
|
|
await os.apiWithDialog('i/update', {
|
|
|
|
mutingNotificationTypes: notificationTypes.filter(x => !value.includes(x)),
|
|
|
|
}).then(i => {
|
|
|
|
$i!.mutingNotificationTypes = i.mutingNotificationTypes;
|
|
|
|
});
|
2022-06-20 17:38:49 +09:00
|
|
|
},
|
2022-05-04 12:25:19 +09:00
|
|
|
}, 'closed');
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.notifications,
|
|
|
|
icon: 'fas fa-bell',
|
|
|
|
bg: 'var(--bg)',
|
2020-10-17 20:12:00 +09:00
|
|
|
});
|
|
|
|
</script>
|