feat: thread mute (#7930)
* feat: thread mute * chore: fix comment * fix test * fix * refactor
This commit is contained in:
parent
f47a564819
commit
fc65190ef7
18 changed files with 375 additions and 14 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue