diff options
| author | piuvas <piuvas@proton.me> | 2024-12-23 10:50:31 -0300 |
|---|---|---|
| committer | piuvas <piuvas@proton.me> | 2024-12-23 10:50:31 -0300 |
| commit | 83460279c0217096f95225b6ceff5393c8a439d4 (patch) | |
| tree | 96bf7894ab5a6041867e2809ca7afc561713c24e /packages/backend/src | |
| parent | merge: Revert "Synchronize server startup" (!831) (diff) | |
| download | sharkey-83460279c0217096f95225b6ceff5393c8a439d4.tar.gz sharkey-83460279c0217096f95225b6ceff5393c8a439d4.tar.bz2 sharkey-83460279c0217096f95225b6ceff5393c8a439d4.zip | |
populate myreaction on replies for streams.
Diffstat (limited to 'packages/backend/src')
5 files changed, 35 insertions, 0 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 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); |