From 61349c6f0a6ab0f9dce514bf6faae28719df949c Mon Sep 17 00:00:00 2001 From: patak Date: Thu, 29 Dec 2022 22:04:32 +0100 Subject: [PATCH] feat: allow reordering reblogs of replies --- components/status/StatusCard.vue | 6 +++--- composables/masto.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 54022d535..d1e154408 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -28,8 +28,8 @@ const status = $computed(() => { return props.status }) -// 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 || props.status.inReplyToId === props.newer?.reblog?.id))) +// Use original status, avoid connecting a reblog +const directReply = $computed(() => props.hasNewer || (!!status.inReplyToId && (status.inReplyToId === props.newer?.id || status.inReplyToId === props.newer?.reblog?.id))) // Use reblogged status, connect it to further replies const connectReply = $computed(() => props.hasOlder || status.id === props.older?.inReplyToId) @@ -103,7 +103,7 @@ const isDM = $computed(() => status.visibility === 'direct') >
-
+
diff --git a/composables/masto.ts b/composables/masto.ts index 0d708cfeb..b4973a9ab 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -179,8 +179,8 @@ export function timelineWithReorderedReplies(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++) { - const inReplyToId = newItems[i - k].inReplyToId // TODO: ?? newItems[i - k].reblog?.inReplyToId - if (inReplyToId === newItems[i].reblog?.id || inReplyToId === newItems[i].id) { + const inReplyToId = newItems[i - k].inReplyToId ?? newItems[i - k].reblog?.inReplyToId + if (inReplyToId && (inReplyToId === newItems[i].reblog?.id || inReplyToId === newItems[i].id)) { const item = newItems.splice(i, 1)[0] newItems.splice(i - k, 0, item) k = 1