mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-19 23:40:07 +00:00
feat: allow reordering reblogs of replies
This commit is contained in:
parent
28e26f6b12
commit
61349c6f0a
2 changed files with 5 additions and 5 deletions
|
@ -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')
|
|||
>
|
||||
<div flex justify-between>
|
||||
<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 />
|
||||
<AccountInlineInfo font-bold :account="rebloggedBy" :avatar="!avatarOnAvatar" />
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue