From 83460279c0217096f95225b6ceff5393c8a439d4 Mon Sep 17 00:00:00 2001 From: piuvas Date: Mon, 23 Dec 2024 10:50:31 -0300 Subject: [PATCH 1/5] populate myreaction on replies for streams. --- .../src/server/api/stream/channels/bubble-timeline.ts | 7 +++++++ .../src/server/api/stream/channels/global-timeline.ts | 7 +++++++ .../src/server/api/stream/channels/home-timeline.ts | 7 +++++++ .../src/server/api/stream/channels/hybrid-timeline.ts | 7 +++++++ .../src/server/api/stream/channels/local-timeline.ts | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts index 8693f0c6ac..b8cbe4f283 100644 --- a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts @@ -72,6 +72,13 @@ class BubbleTimelineChannel extends Channel { } } + if (this.user && note.reply) { + if (Object.keys(note.reply.reactions).length > 0) { + const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myRenoteReaction; + } + } + this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 6fe76747ee..43aa99e8c4 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -67,6 +67,13 @@ class GlobalTimelineChannel extends Channel { } } + if (this.user && note.reply) { + if (Object.keys(note.reply.reactions).length > 0) { + const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myRenoteReaction; + } + } + this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 359ab3e223..05040b9099 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -88,6 +88,13 @@ class HomeTimelineChannel extends Channel { } } + if (this.user && note.reply) { + if (Object.keys(note.reply.reactions).length > 0) { + const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myRenoteReaction; + } + } + this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 01645fe657..b268904f04 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -106,6 +106,13 @@ class HybridTimelineChannel extends Channel { } } + if (this.user && note.reply) { + if (Object.keys(note.reply.reactions).length > 0) { + const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myRenoteReaction; + } + } + this.connection.cacheNote(note); this.send('note', note); diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 1f9d25b44d..8d75a0c3a2 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -77,6 +77,13 @@ class LocalTimelineChannel extends Channel { } } + if (this.user && note.reply) { + if (Object.keys(note.reply.reactions).length > 0) { + const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myRenoteReaction; + } + } + this.connection.cacheNote(note); this.send('note', note); From 94c3a71e499f8d508dfd1e49727d6a2d04031873 Mon Sep 17 00:00:00 2001 From: piuvas Date: Mon, 23 Dec 2024 20:42:21 -0300 Subject: [PATCH 2/5] improvements. --- .../src/server/api/stream/channels/bubble-timeline.ts | 10 ++++++++-- .../src/server/api/stream/channels/global-timeline.ts | 10 ++++++++-- .../src/server/api/stream/channels/home-timeline.ts | 10 ++++++++-- .../src/server/api/stream/channels/hybrid-timeline.ts | 10 ++++++++-- .../src/server/api/stream/channels/local-timeline.ts | 10 ++++++++-- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts index b8cbe4f283..41b7b7cd3c 100644 --- a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts @@ -70,12 +70,18 @@ class BubbleTimelineChannel extends Channel { const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); note.renote.myReaction = myRenoteReaction; } + if (note.renote && note.renote.reply) { + if (Object.keys(note.renote.reply.reactions).length > 0) { + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); + note.renote.reply.myReaction = myReplyReaction; + } + } } if (this.user && note.reply) { if (Object.keys(note.reply.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myRenoteReaction; + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myReplyReaction; } } diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 43aa99e8c4..6da21ac72c 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -65,12 +65,18 @@ class GlobalTimelineChannel extends Channel { const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); note.renote.myReaction = myRenoteReaction; } + if (note.renote && note.renote.reply) { + if (Object.keys(note.renote.reply.reactions).length > 0) { + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); + note.renote.reply.myReaction = myReplyReaction; + } + } } if (this.user && note.reply) { if (Object.keys(note.reply.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myRenoteReaction; + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myReplyReaction; } } diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 05040b9099..d4b65222a0 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -86,12 +86,18 @@ class HomeTimelineChannel extends Channel { const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); note.renote.myReaction = myRenoteReaction; } + if (note.renote && note.renote.reply) { + if (Object.keys(note.renote.reply.reactions).length > 0) { + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); + note.renote.reply.myReaction = myReplyReaction; + } + } } if (this.user && note.reply) { if (Object.keys(note.reply.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myRenoteReaction; + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myReplyReaction; } } diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index b268904f04..c989721463 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -104,12 +104,18 @@ class HybridTimelineChannel extends Channel { const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); note.renote.myReaction = myRenoteReaction; } + if (note.renote && note.renote.reply) { + if (Object.keys(note.renote.reply.reactions).length > 0) { + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); + note.renote.reply.myReaction = myReplyReaction; + } + } } if (this.user && note.reply) { if (Object.keys(note.reply.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myRenoteReaction; + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myReplyReaction; } } diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 8d75a0c3a2..2f1720f8fe 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -75,12 +75,18 @@ class LocalTimelineChannel extends Channel { const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); note.renote.myReaction = myRenoteReaction; } + if (note.renote && note.renote.reply) { + if (Object.keys(note.renote.reply.reactions).length > 0) { + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); + note.renote.reply.myReaction = myReplyReaction; + } + } } if (this.user && note.reply) { if (Object.keys(note.reply.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myRenoteReaction; + const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); + note.reply.myReaction = myReplyReaction; } } From 64abef8be9897db493670a63817ee2876db079b8 Mon Sep 17 00:00:00 2001 From: piuvas Date: Wed, 25 Dec 2024 16:41:40 -0300 Subject: [PATCH 3/5] turn task into a function --- .../backend/src/server/api/stream/channel.ts | 9 +++++++ .../api/stream/channels/bubble-timeline.ts | 22 ++++++---------- .../api/stream/channels/global-timeline.ts | 22 ++++++---------- .../api/stream/channels/home-timeline.ts | 22 ++++++---------- .../api/stream/channels/hybrid-timeline.ts | 25 +++++++------------ .../api/stream/channels/local-timeline.ts | 22 ++++++---------- 6 files changed, 50 insertions(+), 72 deletions(-) diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts index ae9c7e3e99..cded294bf4 100644 --- a/packages/backend/src/server/api/stream/channel.ts +++ b/packages/backend/src/server/api/stream/channel.ts @@ -10,6 +10,7 @@ import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js'; import type { Packed } from '@/misc/json-schema.js'; import type { JsonObject, JsonValue } from '@/misc/json-value.js'; import type Connection from './Connection.js'; +import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; /** * Stream channel @@ -101,6 +102,14 @@ export default abstract class Channel { public dispose?(): void; public onMessage?(type: string, body: JsonValue): void; + + public async assignMyReaction(note: Packed<'Note'>, noteEntityService: NoteEntityService) { + if (this.user === undefined) { return; } + if (Object.keys(note.reactions).length > 0) { + const myReaction = await noteEntityService.populateMyReaction(note, this.user.id); + note.myReaction = myReaction; + } + } } export type MiChannelService = { diff --git a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts index 41b7b7cd3c..a0875288a2 100644 --- a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts @@ -65,25 +65,19 @@ class BubbleTimelineChannel extends Channel { if (this.isNoteMutedOrBlocked(note)) return; + const reactionsToFetch = []; if (this.user && isRenotePacked(note) && !isQuotePacked(note)) { - if (note.renote && Object.keys(note.renote.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); - note.renote.myReaction = myRenoteReaction; - } - if (note.renote && note.renote.reply) { - if (Object.keys(note.renote.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); - note.renote.reply.myReaction = myReplyReaction; + if (note.renote) { + reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService)); + if (note.renote.reply) { + reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } + } else if (this.user && note.reply) { + reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } - if (this.user && note.reply) { - if (Object.keys(note.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myReplyReaction; - } - } + await Promise.all(reactionsToFetch); this.connection.cacheNote(note); diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 6da21ac72c..d133d84c09 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -60,25 +60,19 @@ class GlobalTimelineChannel extends Channel { if (this.isNoteMutedOrBlocked(note)) return; + const reactionsToFetch = []; if (this.user && isRenotePacked(note) && !isQuotePacked(note)) { - if (note.renote && Object.keys(note.renote.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); - note.renote.myReaction = myRenoteReaction; - } - if (note.renote && note.renote.reply) { - if (Object.keys(note.renote.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); - note.renote.reply.myReaction = myReplyReaction; + if (note.renote) { + reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService)); + if (note.renote.reply) { + reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } + } else if (this.user && note.reply) { + reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } - if (this.user && note.reply) { - if (Object.keys(note.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myReplyReaction; - } - } + await Promise.all(reactionsToFetch); this.connection.cacheNote(note); diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index d4b65222a0..8c059e2405 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -81,25 +81,19 @@ class HomeTimelineChannel extends Channel { if (this.isNoteMutedOrBlocked(note)) return; + const reactionsToFetch = []; if (this.user && isRenotePacked(note) && !isQuotePacked(note)) { - if (note.renote && Object.keys(note.renote.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); - note.renote.myReaction = myRenoteReaction; - } - if (note.renote && note.renote.reply) { - if (Object.keys(note.renote.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); - note.renote.reply.myReaction = myReplyReaction; + if (note.renote) { + reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService)); + if (note.renote.reply) { + reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } + } else if (this.user && note.reply) { + reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } - if (this.user && note.reply) { - if (Object.keys(note.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myReplyReaction; - } - } + await Promise.all(reactionsToFetch); this.connection.cacheNote(note); diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index c989721463..8eedcdbd59 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -98,26 +98,19 @@ class HybridTimelineChannel extends Channel { } } - if (this.user && note.renoteId && !note.text) { - if (note.renote && Object.keys(note.renote.reactions).length > 0) { - console.log(note.renote.reactionAndUserPairCache); - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); - note.renote.myReaction = myRenoteReaction; - } - if (note.renote && note.renote.reply) { - if (Object.keys(note.renote.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); - note.renote.reply.myReaction = myReplyReaction; + const reactionsToFetch = []; + if (this.user && isRenotePacked(note) && !isQuotePacked(note)) { + if (note.renote) { + reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService)); + if (note.renote.reply) { + reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } + } else if (this.user && note.reply) { + reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } - if (this.user && note.reply) { - if (Object.keys(note.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myReplyReaction; - } - } + await Promise.all(reactionsToFetch); this.connection.cacheNote(note); diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 2f1720f8fe..89187c49fd 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -70,25 +70,19 @@ class LocalTimelineChannel extends Channel { if (this.isNoteMutedOrBlocked(note)) return; + const reactionsToFetch = []; if (this.user && isRenotePacked(note) && !isQuotePacked(note)) { - if (note.renote && Object.keys(note.renote.reactions).length > 0) { - const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); - note.renote.myReaction = myRenoteReaction; - } - if (note.renote && note.renote.reply) { - if (Object.keys(note.renote.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id); - note.renote.reply.myReaction = myReplyReaction; + if (note.renote) { + reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService)); + if (note.renote.reply) { + reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } + } else if (this.user && note.reply) { + reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } - if (this.user && note.reply) { - if (Object.keys(note.reply.reactions).length > 0) { - const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id); - note.reply.myReaction = myReplyReaction; - } - } + await Promise.all(reactionsToFetch); this.connection.cacheNote(note); From 8f96b50b00e84c3874129aa4e1317778948fe02d Mon Sep 17 00:00:00 2001 From: piuvas Date: Thu, 26 Dec 2024 12:27:00 -0300 Subject: [PATCH 4/5] improvement --- packages/backend/src/server/api/stream/channel.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts index cded294bf4..93d5046902 100644 --- a/packages/backend/src/server/api/stream/channel.ts +++ b/packages/backend/src/server/api/stream/channel.ts @@ -104,8 +104,7 @@ export default abstract class Channel { public onMessage?(type: string, body: JsonValue): void; public async assignMyReaction(note: Packed<'Note'>, noteEntityService: NoteEntityService) { - if (this.user === undefined) { return; } - if (Object.keys(note.reactions).length > 0) { + if (this.user && Object.keys(note.reactions).length > 0) { const myReaction = await noteEntityService.populateMyReaction(note, this.user.id); note.myReaction = myReaction; } From 2c742d6e82d98776f28558253f9f5ca3e814de2a Mon Sep 17 00:00:00 2001 From: piuvas Date: Thu, 26 Dec 2024 14:49:22 -0300 Subject: [PATCH 5/5] requested change. --- .../backend/src/server/api/stream/channels/bubble-timeline.ts | 3 ++- .../backend/src/server/api/stream/channels/global-timeline.ts | 3 ++- .../backend/src/server/api/stream/channels/home-timeline.ts | 3 ++- .../backend/src/server/api/stream/channels/hybrid-timeline.ts | 3 ++- .../backend/src/server/api/stream/channels/local-timeline.ts | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts index a0875288a2..b2745db92d 100644 --- a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts @@ -73,7 +73,8 @@ class BubbleTimelineChannel extends Channel { reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } - } else if (this.user && note.reply) { + } + if (this.user && note.reply) { reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index d133d84c09..8df59d906d 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -68,7 +68,8 @@ class GlobalTimelineChannel extends Channel { reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } - } else if (this.user && note.reply) { + } + if (this.user && note.reply) { reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 8c059e2405..f48eff85c9 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -89,7 +89,8 @@ class HomeTimelineChannel extends Channel { reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } - } else if (this.user && note.reply) { + } + if (this.user && note.reply) { reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 8eedcdbd59..8c58b2518e 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -106,7 +106,8 @@ class HybridTimelineChannel extends Channel { reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } - } else if (this.user && note.reply) { + } + if (this.user && note.reply) { reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); } diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 89187c49fd..cb832bd3c2 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -78,7 +78,8 @@ class LocalTimelineChannel extends Channel { reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService)); } } - } else if (this.user && note.reply) { + } + if (this.user && note.reply) { reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService)); }