mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 21:01:03 +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
1 changed files with 1 additions and 7 deletions
|
@ -490,16 +490,10 @@ fn queries<'a>() -> Queries<
|
||||||
query = query.filter(post_aggregates::published.gt(now() - interval));
|
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 = [
|
let sorts = [
|
||||||
Some((Ord::Desc, featured_field)),
|
Some((Ord::Desc, featured_field)),
|
||||||
Some(main_sort),
|
Some(main_sort),
|
||||||
tie_breaker,
|
Some((Ord::Desc, field!(post_id))),
|
||||||
];
|
];
|
||||||
let sorts_iter = sorts.iter().flatten();
|
let sorts_iter = sorts.iter().flatten();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue