Skip to content

Commit

Permalink
feat: connect reblogs + direct reply in home timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 28, 2022
1 parent 107ac8a commit 010bfc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions components/status/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion components/timeline/TimelineHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 010bfc4

Please sign in to comment.