From 94c3a71e499f8d508dfd1e49727d6a2d04031873 Mon Sep 17 00:00:00 2001 From: piuvas Date: Mon, 23 Dec 2024 20:42:21 -0300 Subject: [PATCH] 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; } }