Add secondary sort by published date for post view (fixes #4383) (#4384)

add_site_to_person_details
Nutomic 2024-01-22 14:52:21 +01:00 committed by GitHub
parent e78fe5a34c
commit 0868910570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -492,8 +492,14 @@ fn queries<'a>() -> Queries<
} }
let sorts = [ let sorts = [
// featured posts first
Some((Ord::Desc, featured_field)), Some((Ord::Desc, featured_field)),
// then use the main sort
Some(main_sort), Some(main_sort),
// hot rank reaches zero after some days, use publish as fallback. necessary because old
// posts can be fetched over federation and inserted with high post id
Some((Ord::Desc, field!(published))),
// finally use unique post id as tie breaker
Some((Ord::Desc, field!(post_id))), Some((Ord::Desc, field!(post_id))),
]; ];
let sorts_iter = sorts.iter().flatten(); let sorts_iter = sorts.iter().flatten();