From 2bb8642a2c0931d928187f76bf204fc82a184801 Mon Sep 17 00:00:00 2001 From: Michcio Date: Sun, 25 Sep 2022 15:07:28 +0200 Subject: [PATCH] backend: Fix thread muting queries findOne != findOneBy --- packages/backend/src/server/api/endpoints/notes/polls/vote.ts | 2 +- packages/backend/src/services/note/polls/vote.ts | 2 +- packages/backend/src/services/note/reaction/create.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index a6b86a7eb..331b03971 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -137,7 +137,7 @@ export default define(meta, paramDef, async (ps, user) => { }); // check if this thread and notification type is muted - const threadMuted = await NoteThreadMutings.findOne({ + const threadMuted = await NoteThreadMutings.findOneBy({ userId: note.userId, threadId: note.threadId || note.id, mutingNotificationTypes: ArrayOverlap(['pollVote']), diff --git a/packages/backend/src/services/note/polls/vote.ts b/packages/backend/src/services/note/polls/vote.ts index 057e29005..90be1c844 100644 --- a/packages/backend/src/services/note/polls/vote.ts +++ b/packages/backend/src/services/note/polls/vote.ts @@ -58,7 +58,7 @@ export default async function(user: CacheableUser, note: Note, choice: number) { }); // check if this thread and notification type is muted - const muted = await NoteThreadMutings.findOne({ + const muted = await NoteThreadMutings.findOneBy({ userId: note.userId, threadId: note.threadId || note.id, mutingNotificationTypes: ArrayOverlap(['pollVote']), diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index 9d3882a0c..2bd19b685 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -99,7 +99,7 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, }); // check if this thread is muted - const threadMuted = await NoteThreadMutings.findOne({ + const threadMuted = await NoteThreadMutings.findOneBy({ userId: note.userId, threadId: note.threadId || note.id, mutingNotificationTypes: ArrayOverlap(['reaction']),