feat: allow reordering reblogs of replies

zio/stable
patak 2022-12-29 22:04:32 +01:00
parent 28e26f6b12
commit 61349c6f0a
2 changed files with 5 additions and 5 deletions

View File

@ -28,8 +28,8 @@ const status = $computed(() => {
return props.status return props.status
}) })
// Use original status, avoid connecting a reblog (review if we should relax this) // Use original status, avoid connecting a reblog
const directReply = $computed(() => props.hasNewer || (!!props.status.inReplyToId && (props.status.inReplyToId === props.newer?.id || props.status.inReplyToId === props.newer?.reblog?.id))) 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 // Use reblogged status, connect it to further replies
const connectReply = $computed(() => props.hasOlder || status.id === props.older?.inReplyToId) const connectReply = $computed(() => props.hasOlder || status.id === props.older?.inReplyToId)
@ -103,7 +103,7 @@ const isDM = $computed(() => status.visibility === 'direct')
> >
<div flex justify-between> <div flex justify-between>
<slot name="meta"> <slot name="meta">
<div v-if="rebloggedBy && !collapseRebloggedBy" text-secondary text-sm ws-nowrap flex="~" gap-1 items-center py1> <div v-if="rebloggedBy && !collapseRebloggedBy" text-secondary text-sm ws-nowrap flex="~" gap-1 items-center py1 bg-base>
<div i-ri:repeat-fill mr-1 text-primary /> <div i-ri:repeat-fill mr-1 text-primary />
<AccountInlineInfo font-bold :account="rebloggedBy" :avatar="!avatarOnAvatar" /> <AccountInlineInfo font-bold :account="rebloggedBy" :avatar="!avatarOnAvatar" />
</div> </div>

View File

@ -179,8 +179,8 @@ export function timelineWithReorderedReplies(items: Status[]) {
// TODO: Basic reordering, we should get something more efficient and robust // TODO: Basic reordering, we should get something more efficient and robust
for (let i = items.length - 1; i > 0; i--) { for (let i = items.length - 1; i > 0; i--) {
for (let k = 1; k <= maxDistance && i - k >= 0; k++) { for (let k = 1; k <= maxDistance && i - k >= 0; k++) {
const inReplyToId = newItems[i - k].inReplyToId // TODO: ?? newItems[i - k].reblog?.inReplyToId const inReplyToId = newItems[i - k].inReplyToId ?? newItems[i - k].reblog?.inReplyToId
if (inReplyToId === newItems[i].reblog?.id || inReplyToId === newItems[i].id) { if (inReplyToId && (inReplyToId === newItems[i].reblog?.id || inReplyToId === newItems[i].id)) {
const item = newItems.splice(i, 1)[0] const item = newItems.splice(i, 1)[0]
newItems.splice(i - k, 0, item) newItems.splice(i - k, 0, item)
k = 1 k = 1