fix (backend): apply word mutes in notifications
Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
parent
1bf513dedd
commit
020c421c9b
2 changed files with 10 additions and 5 deletions
|
@ -7,6 +7,7 @@ import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-
|
|||
import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js";
|
||||
import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js";
|
||||
import { generateMutedNoteThreadQuery } from "@/server/api/common/generate-muted-note-thread-query.js";
|
||||
import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["notes"],
|
||||
|
@ -69,6 +70,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
|
||||
generateVisibilityQuery(query, user);
|
||||
generateMutedUserQuery(query, user);
|
||||
generateMutedNoteQuery(query, user);
|
||||
generateMutedNoteThreadQuery(query, user);
|
||||
generateBlockedUserQuery(query, user);
|
||||
|
||||
|
|
|
@ -885,14 +885,17 @@ async function createMentionedEvents(
|
|||
nm: NotificationManager,
|
||||
) {
|
||||
for (const u of mentionedUsers.filter((u) => Users.isLocalUser(u))) {
|
||||
const threadMuted = await NoteThreadMutings.findOneBy({
|
||||
const isWordMuted = await MutedNotes.existsBy({
|
||||
userId: u.id,
|
||||
threadId: note.threadId || note.id,
|
||||
noteId: note.id,
|
||||
});
|
||||
if (isWordMuted) continue;
|
||||
|
||||
if (threadMuted) {
|
||||
continue;
|
||||
}
|
||||
const isThreadMuted = await NoteThreadMutings.existsBy({
|
||||
userId: u.id,
|
||||
threadId: note.threadId ?? note.id,
|
||||
});
|
||||
if (isThreadMuted) continue;
|
||||
|
||||
// note with "specified" visibility might not be visible to mentioned users
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue