summaryrefslogtreecommitdiff
path: root/src/services/note/unread.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-10-31 15:30:22 +0900
committerGitHub <noreply@github.com>2021-10-31 15:30:22 +0900
commitfc65190ef7b687650018cccfee2219bf00827f70 (patch)
treed2482c79dd095509b8b57dac28db460fb812196a /src/services/note/unread.ts
parentfix: Fix #7895 (#7937) (diff)
downloadsharkey-fc65190ef7b687650018cccfee2219bf00827f70.tar.gz
sharkey-fc65190ef7b687650018cccfee2219bf00827f70.tar.bz2
sharkey-fc65190ef7b687650018cccfee2219bf00827f70.zip
feat: thread mute (#7930)
* feat: thread mute * chore: fix comment * fix test * fix * refactor
Diffstat (limited to 'src/services/note/unread.ts')
-rw-r--r--src/services/note/unread.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/services/note/unread.ts b/src/services/note/unread.ts
index 4a9df6083c..29d2b54af8 100644
--- a/src/services/note/unread.ts
+++ b/src/services/note/unread.ts
@@ -1,10 +1,10 @@
import { Note } from '@/models/entities/note';
import { publishMainStream } from '@/services/stream';
import { User } from '@/models/entities/user';
-import { Mutings, NoteUnreads } from '@/models/index';
+import { Mutings, NoteThreadMutings, NoteUnreads } from '@/models/index';
import { genId } from '@/misc/gen-id';
-export default async function(userId: User['id'], note: Note, params: {
+export async function insertNoteUnread(userId: User['id'], note: Note, params: {
// NOTE: isSpecifiedがtrueならisMentionedは必ずfalse
isSpecified: boolean;
isMentioned: boolean;
@@ -17,6 +17,13 @@ export default async function(userId: User['id'], note: Note, params: {
if (mute.map(m => m.muteeId).includes(note.userId)) return;
//#endregion
+ // スレッドミュート
+ const threadMute = await NoteThreadMutings.findOne({
+ userId: userId,
+ threadId: note.threadId || note.id,
+ });
+ if (threadMute) return;
+
const unread = {
id: genId(),
noteId: note.id,