]> Untitled Git - lemmy.git/commitdiff
Sort community search by active_monthly by default. (#2728)
authorDessalines <dessalines@users.noreply.github.com>
Tue, 14 Feb 2023 14:19:37 +0000 (09:19 -0500)
committerGitHub <noreply@github.com>
Tue, 14 Feb 2023 14:19:37 +0000 (15:19 +0100)
- Fixes #2678

crates/apub/src/http/mod.rs
crates/db_views_actor/src/community_view.rs

index 83272d120e52552cf9dcd7bf45ae4a9fb2dfe5e2..8b53991940f10a482deced50a9573de48d56ffb0 100644 (file)
@@ -128,7 +128,7 @@ pub(crate) async fn get_activity(
 
   let sensitive = activity.sensitive.unwrap_or(true);
   if !activity.local {
 
   let sensitive = activity.sensitive.unwrap_or(true);
   if !activity.local {
-    return Err(err_object_not_local());
+    Err(err_object_not_local())
   } else if sensitive {
     Ok(HttpResponse::Forbidden().finish())
   } else {
   } else if sensitive {
     Ok(HttpResponse::Forbidden().finish())
   } else {
index a4b64a288e548ad1201cecd1f9a90514fca18396..e59025a5f84242e0d16f01cadaad1ab49e12e71b 100644 (file)
@@ -19,7 +19,7 @@ use lemmy_db_schema::{
     local_user::LocalUser,
   },
   traits::{ToSafe, ViewToVec},
     local_user::LocalUser,
   },
   traits::{ToSafe, ViewToVec},
-  utils::{functions::hot_rank, fuzzy_search, get_conn, limit_and_offset, DbPool},
+  utils::{fuzzy_search, get_conn, limit_and_offset, DbPool},
   ListingType,
   SortType,
 };
   ListingType,
   SortType,
 };
@@ -164,15 +164,7 @@ impl<'a> CommunityQuery<'a> {
       SortType::TopAll => query = query.order_by(community_aggregates::subscribers.desc()),
       SortType::TopMonth => query = query.order_by(community_aggregates::users_active_month.desc()),
       SortType::Hot => {
       SortType::TopAll => query = query.order_by(community_aggregates::subscribers.desc()),
       SortType::TopMonth => query = query.order_by(community_aggregates::users_active_month.desc()),
       SortType::Hot => {
-        query = query
-          .order_by(
-            hot_rank(
-              community_aggregates::subscribers,
-              community_aggregates::published,
-            )
-            .desc(),
-          )
-          .then_order_by(community_aggregates::published.desc());
+        query = query.order_by(community_aggregates::users_active_month.desc());
         // Don't show hidden communities in Hot (trending)
         query = query.filter(
           community::hidden
         // Don't show hidden communities in Hot (trending)
         query = query.filter(
           community::hidden
@@ -181,17 +173,7 @@ impl<'a> CommunityQuery<'a> {
         );
       }
       // Covers all other sorts
         );
       }
       // Covers all other sorts
-      _ => {
-        query = query
-          .order_by(
-            hot_rank(
-              community_aggregates::subscribers,
-              community_aggregates::published,
-            )
-            .desc(),
-          )
-          .then_order_by(community_aggregates::published.desc())
-      }
+      _ => query = query.order_by(community_aggregates::users_active_month.desc()),
     };
 
     if let Some(listing_type) = self.listing_type {
     };
 
     if let Some(listing_type) = self.listing_type {