diff options
| author | okayurisotto <okayurisotto@proton.me> | 2023-07-11 14:58:58 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-11 14:58:58 +0900 |
| commit | cf3e39178b4180bfc5f57b8bb766faf5b5fc99b9 (patch) | |
| tree | 40d7b3daa5a02d715fc82528cc060df4744c46f2 /packages/backend/src/core/NoteCreateService.ts | |
| parent | chore(frontend): Remove experimental flag from migration feature (diff) | |
| download | sharkey-cf3e39178b4180bfc5f57b8bb766faf5b5fc99b9.tar.gz sharkey-cf3e39178b4180bfc5f57b8bb766faf5b5fc99b9.tar.bz2 sharkey-cf3e39178b4180bfc5f57b8bb766faf5b5fc99b9.zip | |
refactor(backend): 存在確認の`findOneBy`を`exist`に置き換え (#11224)
* refactor(backend): 存在確認の`findOneBy`を`exist`に置き換え
* cleanup
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteCreateService.ts | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index fb36ca3b6a..4f3d66dd58 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -570,12 +570,14 @@ export class NoteCreateService implements OnApplicationShutdown { if (data.reply) { // 通知 if (data.reply.userHost === null) { - const threadMuted = await this.noteThreadMutingsRepository.findOneBy({ - userId: data.reply.userId, - threadId: data.reply.threadId ?? data.reply.id, + const isThreadMuted = await this.noteThreadMutingsRepository.exist({ + where: { + userId: data.reply.userId, + threadId: data.reply.threadId ?? data.reply.id, + } }); - if (!threadMuted) { + if (!isThreadMuted) { nm.push(data.reply.userId, 'reply'); this.globalEventService.publishMainStream(data.reply.userId, 'reply', noteObj); @@ -712,12 +714,14 @@ export class NoteCreateService implements OnApplicationShutdown { @bindThis private async createMentionedEvents(mentionedUsers: MinimumUser[], note: Note, nm: NotificationManager) { for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) { - const threadMuted = await this.noteThreadMutingsRepository.findOneBy({ - userId: u.id, - threadId: note.threadId ?? note.id, + const isThreadMuted = await this.noteThreadMutingsRepository.exist({ + where: { + userId: u.id, + threadId: note.threadId ?? note.id, + }, }); - if (threadMuted) { + if (isThreadMuted) { continue; } |