feat: thread mute (#7930)

* feat: thread mute

* chore: fix comment

* fix test

* fix

* refactor
This commit is contained in:
syuilo 2021-10-31 15:30:22 +09:00 committed by GitHub
parent f47a564819
commit fc65190ef7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 375 additions and 14 deletions

View file

@ -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,