From: Dessalines Date: Fri, 24 Feb 2023 04:33:54 +0000 (-0500) Subject: Cleaning up person_view sorts (#2760) X-Git-Url: http://these/git/%7B%60/feeds/inbox/%22%7B%7D/static/%7Bthis.props.imageSrc%7D?a=commitdiff_plain;h=4c77c84b601cd10b09079e34fe9a6fbbe7d8525b;p=lemmy.git Cleaning up person_view sorts (#2760) --- diff --git a/crates/db_views_actor/src/person_view.rs b/crates/db_views_actor/src/person_view.rs index 6dc618f7..14c413c8 100644 --- a/crates/db_views_actor/src/person_view.rs +++ b/crates/db_views_actor/src/person_view.rs @@ -95,17 +95,12 @@ impl<'a> PersonQuery<'a> { } query = match self.sort.unwrap_or(SortType::Hot) { - SortType::Hot => query - .order_by(person_aggregates::comment_score.desc()) - .then_order_by(person::published.desc()), - SortType::Active => query - .order_by(person_aggregates::comment_score.desc()) - .then_order_by(person::published.desc()), - SortType::New | SortType::MostComments | SortType::NewComments => { - query.order_by(person::published.desc()) - } + SortType::New | SortType::NewComments => query.order_by(person::published.desc()), SortType::Old => query.order_by(person::published.asc()), - SortType::TopAll => query.order_by(person_aggregates::comment_score.desc()), + SortType::Hot | SortType::Active | SortType::TopAll => { + query.order_by(person_aggregates::comment_score.desc()) + } + SortType::MostComments => query.order_by(person_aggregates::comment_count.desc()), SortType::TopYear => query .filter(person::published.gt(now - 1.years())) .order_by(person_aggregates::comment_score.desc()),