mirror of
https://github.com/defnull/fediwall.git
synced 2025-03-10 19:38:13 +01:00
fix: Keep most recent version of each post.
The date of a post is the boost date in case of a reblog. This is intentional, because popular (boosted) posts should move up again. This change ensures that we always display the most recent post/boost.
This commit is contained in:
parent
263aef3671
commit
ceea0b4aff
@ -85,10 +85,14 @@ export async function fetchPosts(cfg: Config, onProgress: (progress: Progress) =
|
||||
const addOrReplacePost = (post: Post) => {
|
||||
const posts = progress.posts;
|
||||
const i = posts.findIndex(p => p.id === post.id)
|
||||
if (i >= 0)
|
||||
posts[i] = post
|
||||
else
|
||||
if(i < 0) {
|
||||
// Add new posts to the end of the list
|
||||
posts.unshift(post)
|
||||
} else if (posts[i].date < post.date) {
|
||||
// If there are two posts with the same ID, keep the more recent one.
|
||||
// This is so that posts appear more recent if they are boosted.
|
||||
posts[i] = post
|
||||
}
|
||||
}
|
||||
|
||||
const fixLocalAcct = (domain: string, status: MastodonStatus): MastodonStatus => {
|
||||
|
Loading…
Reference in New Issue
Block a user