From 010bfc4179ba1b59863dad5d80bd598202e4c717 Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 28 Dec 2022 09:34:58 +0100 Subject: [PATCH] feat: connect reblogs + direct reply in home timeline --- components/status/StatusCard.vue | 5 +++-- components/timeline/TimelineHome.vue | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 8ea60adb..852693a1 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -26,8 +26,9 @@ const status = $computed(() => { }) // Use original status, avoid connecting a reblog (review if we should relax this) -const directReply = $computed(() => props.hasNewer || (!!props.status.inReplyToId && props.status.inReplyToId === props.newer?.id)) -const connectReply = $computed(() => props.hasOlder || props.status.id === props.older?.inReplyToId) +const directReply = $computed(() => props.hasNewer || (!!props.status.inReplyToId && (props.status.inReplyToId === props.newer?.id || props.status.inReplyToId === props.newer?.reblog?.id))) +// Use reblogged status, connect it to further replies +const connectReply = $computed(() => props.hasOlder || status.id === props.older?.inReplyToId) const rebloggedBy = $computed(() => props.status.reblog ? props.status.account : null) diff --git a/components/timeline/TimelineHome.vue b/components/timeline/TimelineHome.vue index 22b60178..10d5c26a 100644 --- a/components/timeline/TimelineHome.vue +++ b/components/timeline/TimelineHome.vue @@ -10,7 +10,8 @@ function preprocess(items: Status[]) { // TODO: Basic reordering, we should get something more efficient and robust for (let i = items.length - 1; i > 0; i--) { for (let k = 1; k <= maxDistance && i - k >= 0; k++) { - if (newItems[i - k].inReplyToId === newItems[i].id) { + const inReplyToId = newItems[i - k].inReplyToId // TODO: ?? newItems[i - k].reblog?.inReplyToId + if (inReplyToId === newItems[i].reblog?.id || inReplyToId === newItems[i].id) { const item = newItems.splice(i, 1)[0] newItems.splice(i - k, 0, item) k = 1