From 61f517a3d1933817f23701694aae2974ca669b91 Mon Sep 17 00:00:00 2001 From: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> Date: Sat, 20 Jul 2024 23:44:05 +0900 Subject: [PATCH] fix(backend): thread mute did not suppress RN/Quote --- .../backend/src/core/NoteCreateService.ts | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 56ddcefd7c..a51c3a1c1f 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -656,20 +656,29 @@ export class NoteCreateService implements OnApplicationShutdown { if (this.isRenote(data)) { const type = this.isQuote(data) ? 'quote' : 'renote'; - // Notify if (data.renote.userHost === null) { - nm.push(data.renote.userId, type); - } + const isThreadMuted = await this.noteThreadMutingsRepository.exists({ + where: { + userId: data.renote.userId, + threadId: data.renote.threadId ?? data.renote.id, + }, + }); - // Publish event - if ((user.id !== data.renote.userId) && data.renote.userHost === null) { - this.globalEventService.publishMainStream(data.renote.userId, 'renote', noteObj); + if (!isThreadMuted) { + // Notify + nm.push(data.renote.userId, type); - const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.renote!.userId && x.on.includes('renote')); - for (const webhook of webhooks) { - this.queueService.userWebhookDeliver(webhook, 'renote', { - note: noteObj, - }); + // Publish event + if (user.id !== data.renote.userId) { + this.globalEventService.publishMainStream(data.renote.userId, 'renote', noteObj); + + const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.renote!.userId && x.on.includes('renote')); + for (const webhook of webhooks) { + this.queueService.userWebhookDeliver(webhook, 'renote', { + note: noteObj, + }); + } + } } } }