Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort community search by active_monthly by default. #2728

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/apub/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub(crate) async fn get_activity(

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 {
Expand Down
24 changes: 3 additions & 21 deletions crates/db_views_actor/src/community_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use lemmy_db_schema::{
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,
};
Expand Down Expand Up @@ -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 => {
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
Expand All @@ -181,17 +173,7 @@ impl<'a> CommunityQuery<'a> {
);
}
// 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 {
Expand Down