mirror of https://github.com/LemmyNet/lemmy.git
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>pull/4279/head
parent
7a182c982b
commit
a7ba5c9dd3
|
@ -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 New Issue