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/NoteReadService.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/NoteReadService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteReadService.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/backend/src/core/NoteReadService.ts b/packages/backend/src/core/NoteReadService.ts index b84591e26d..52e9bd369a 100644 --- a/packages/backend/src/core/NoteReadService.ts +++ b/packages/backend/src/core/NoteReadService.ts @@ -43,11 +43,13 @@ export class NoteReadService implements OnApplicationShutdown { //#endregion // スレッドミュート - const threadMute = await this.noteThreadMutingsRepository.findOneBy({ - userId: userId, - threadId: note.threadId ?? note.id, + const isThreadMuted = await this.noteThreadMutingsRepository.exist({ + where: { + userId: userId, + threadId: note.threadId ?? note.id, + }, }); - if (threadMute) return; + if (isThreadMuted) return; const unread = { id: this.idService.genId(), @@ -62,9 +64,9 @@ export class NoteReadService implements OnApplicationShutdown { // 2秒経っても既読にならなかったら「未読の投稿がありますよ」イベントを発行する setTimeout(2000, 'unread note', { signal: this.#shutdownController.signal }).then(async () => { - const exist = await this.noteUnreadsRepository.findOneBy({ id: unread.id }); + const exist = await this.noteUnreadsRepository.exist({ where: { id: unread.id } }); - if (exist == null) return; + if (!exist) return; if (params.isMentioned) { this.globalEventService.publishMainStream(userId, 'unreadMention', note.id); |