From a7ba5c9dd33475fd8ae9bb41c39cf8875775a488 Mon Sep 17 00:00:00 2001 From: dullbananas Date: Fri, 15 Dec 2023 04:42:28 -0700 Subject: [PATCH] Sort by post id in post view (#4270) * Sort by post id in post view * Remove tie_breaker --------- Co-authored-by: Dessalines Co-authored-by: Nutomic --- crates/db_views/src/post_view.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 745e32c18..a40e38480 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -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();