]> Untitled Git - lemmy.git/commitdiff
Cleaning up person_view sorts (#2760)
authorDessalines <dessalines@users.noreply.github.com>
Fri, 24 Feb 2023 04:33:54 +0000 (23:33 -0500)
committerGitHub <noreply@github.com>
Fri, 24 Feb 2023 04:33:54 +0000 (13:33 +0900)
crates/db_views_actor/src/person_view.rs

index 6dc618f77ac64c261590a19fd9bb63cc6c906da6..14c413c8492d593ae290108512e37a34b91aa777 100644 (file)
@@ -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()),