enhance: more descriptive info message

This commit is contained in:
Johann150 2022-06-20 22:37:17 +02:00
parent ab84457c0e
commit 87411a6ed8
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
3 changed files with 18 additions and 2 deletions

View file

@ -805,6 +805,7 @@ makeReactionsPublicDescription: "あなたがしたリアクション一覧を
classic: "クラシック"
muteThread: "スレッドをミュート"
unmuteThread: "スレッドのミュートを解除"
threadMuteNotificationsDesc: "このスレッドから表示する通知を選択します。グローバル通知設定も適用され、禁止が優先されます。"
ffVisibility: "つながりの公開範囲"
ffVisibilityDescription: "自分のフォロー/フォロワー情報の公開範囲を設定できます。"
continueThread: "さらにスレッドを見る"

View file

@ -1,5 +1,5 @@
import { noteNotificationTypes } from 'foundkey-js';
import { Notes, NoteThreadMutings } from '@/models/index.js';
import { Notes, NoteThreadMutings, NoteWatchings } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import readNote from '@/services/note/read.js';
import define from '../../../define.js';
@ -62,4 +62,17 @@ export default define(meta, paramDef, async (ps, user) => {
userId: user.id,
mutingNotificationTypes: ps.mutingNotificationTypes,
});
// remove all note watchings in the muted thread
const notesThread = Notes.createQueryBuilder("notes")
.select("note.id")
.where({
threadId: note.threadId ?? note.id,
});
await NoteWatchings.createQueryBuilder()
.delete()
.where(`"note_watching"."noteId" IN (${ notesThread.getQuery() })`)
.setParameters(notesThread.getParameters())
.execute();
});

View file

@ -18,7 +18,7 @@
</MkSwitch>
</div>
<div v-if="!useGlobalSetting" class="_section">
<MkInfo>{{ i18n.ts.notificationSettingDesc }}</MkInfo>
<MkInfo>{{ message }}</MkInfo>
<MkButton inline @click="disableAll">{{ i18n.ts.disableAll }}</MkButton>
<MkButton inline @click="enableAll">{{ i18n.ts.enableAll }}</MkButton>
<MkSwitch v-for="ntype in notificationTypes" :key="ntype" v-model="typesMap[ntype]">{{ i18n.t(`_notification._types.${ntype}`) }}</MkSwitch>
@ -44,10 +44,12 @@ const props = withDefaults(defineProps<{
includingTypes?: typeof foundkey.notificationTypes[number][] | null;
notificationTypes?: typeof foundkey.notificationTypes[number][] | null;
showGlobalToggle?: boolean;
message?: string,
}>(), {
includingTypes: () => [],
notificationTypes: () => [],
showGlobalToggle: true,
message: i18n.ts.notificationSettingDesc,
});
let includingTypes = $computed(() => props.includingTypes || []);