fix(backend): thread mute did not suppress RN/Quote

This commit is contained in:
Sayamame-beans 2024-07-20 23:44:05 +09:00
parent d60c307c4e
commit 61f517a3d1
1 changed files with 20 additions and 11 deletions

View File

@ -656,13 +656,20 @@ export class NoteCreateService implements OnApplicationShutdown {
if (this.isRenote(data)) { if (this.isRenote(data)) {
const type = this.isQuote(data) ? 'quote' : 'renote'; const type = this.isQuote(data) ? 'quote' : 'renote';
// Notify
if (data.renote.userHost === null) { if (data.renote.userHost === null) {
const isThreadMuted = await this.noteThreadMutingsRepository.exists({
where: {
userId: data.renote.userId,
threadId: data.renote.threadId ?? data.renote.id,
},
});
if (!isThreadMuted) {
// Notify
nm.push(data.renote.userId, type); nm.push(data.renote.userId, type);
}
// Publish event // Publish event
if ((user.id !== data.renote.userId) && data.renote.userHost === null) { if (user.id !== data.renote.userId) {
this.globalEventService.publishMainStream(data.renote.userId, 'renote', noteObj); 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')); const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.renote!.userId && x.on.includes('renote'));
@ -673,6 +680,8 @@ export class NoteCreateService implements OnApplicationShutdown {
} }
} }
} }
}
}
nm.notify(); nm.notify();