From 87411a6ed831cdc00cce9bcbc99c770e5bd7b950 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 20 Jun 2022 22:37:17 +0200 Subject: [PATCH] enhance: more descriptive info message --- locales/ja-JP.yml | 1 + .../api/endpoints/notes/thread-muting/create.ts | 15 ++++++++++++++- .../components/notification-setting-window.vue | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index f8ef41ea0..a5b1b3ed2 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -805,6 +805,7 @@ makeReactionsPublicDescription: "あなたがしたリアクション一覧を classic: "クラシック" muteThread: "スレッドをミュート" unmuteThread: "スレッドのミュートを解除" +threadMuteNotificationsDesc: "このスレッドから表示する通知を選択します。グローバル通知設定も適用され、禁止が優先されます。" ffVisibility: "つながりの公開範囲" ffVisibilityDescription: "自分のフォロー/フォロワー情報の公開範囲を設定できます。" continueThread: "さらにスレッドを見る" diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index 3181041a8..f4bd4186d 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -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(); }); diff --git a/packages/client/src/components/notification-setting-window.vue b/packages/client/src/components/notification-setting-window.vue index 7bcf2768f..4edbda033 100644 --- a/packages/client/src/components/notification-setting-window.vue +++ b/packages/client/src/components/notification-setting-window.vue @@ -18,7 +18,7 @@
- {{ i18n.ts.notificationSettingDesc }} + {{ message }} {{ i18n.ts.disableAll }} {{ i18n.ts.enableAll }} {{ i18n.t(`_notification._types.${ntype}`) }} @@ -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 || []);