mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-09 17:55:10 +00:00
Sort by post id in post view (#4270)
* Sort by post id in post view * Remove tie_breaker --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: Nutomic <me@nutomic.com>
This commit is contained in:
parent
7a182c982b
commit
a7ba5c9dd3
|
@ -490,16 +490,10 @@ fn queries<'a>() -> Queries<
|
|||
query = query.filter(post_aggregates::published.gt(now() - interval));
|
||||
}
|
||||
|
||||
let tie_breaker = match options.sort.unwrap_or(SortType::Hot) {
|
||||
// A second time-based sort would not be very useful
|
||||
SortType::New | SortType::Old | SortType::NewComments => None,
|
||||
_ => Some((Ord::Desc, field!(published))),
|
||||
};
|
||||
|
||||
let sorts = [
|
||||
Some((Ord::Desc, featured_field)),
|
||||
Some(main_sort),
|
||||
tie_breaker,
|
||||
Some((Ord::Desc, field!(post_id))),
|
||||
];
|
||||
let sorts_iter = sorts.iter().flatten();
|
||||
|
||||
|
|
Loading…
Reference in a new issue