mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 12:19:08 +01:00
feat: connect reblogs + direct reply in home timeline
This commit is contained in:
parent
107ac8a6b9
commit
010bfc4179
2 changed files with 5 additions and 3 deletions
|
@ -26,8 +26,9 @@ const status = $computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Use original status, avoid connecting a reblog (review if we should relax this)
|
// 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 directReply = $computed(() => props.hasNewer || (!!props.status.inReplyToId && (props.status.inReplyToId === props.newer?.id || props.status.inReplyToId === props.newer?.reblog?.id)))
|
||||||
const connectReply = $computed(() => props.hasOlder || props.status.id === props.older?.inReplyToId)
|
// 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)
|
const rebloggedBy = $computed(() => props.status.reblog ? props.status.account : null)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ function preprocess(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++) {
|
||||||
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]
|
const item = newItems.splice(i, 1)[0]
|
||||||
newItems.splice(i - k, 0, item)
|
newItems.splice(i - k, 0, item)
|
||||||
k = 1
|
k = 1
|
||||||
|
|
Loading…
Reference in a new issue