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

Fix Hidden communities showing in community list #3094

Merged
merged 3 commits into from
Jun 15, 2023
Merged

Conversation

alexmaras
Copy link
Contributor

@alexmaras alexmaras commented Jun 14, 2023

This is my first PR on this repo - let me know if I've missed anything you need from me.

This fixes two issues making the community/hide functionality not work as expected.

  1. Uses None for setting the hidden value on both insert and update. Doing this only on update wouldn't account for when an insert happens when the community already exists in the DB - the do_update in ./crates/db_schema/src/impls/community.rs would override the hidden value. The upshot of this was that searching for a hidden community would make it not hidden anymore.
  2. Only shows hidden communities in lists to admins, mods and subscribers. Previously, this was only happening if sorting by "Hot", which seems kind of confusing. Instead, I figure it should only show up if explicitly searched for. This is what now happens.

@alexmaras
Copy link
Contributor Author

Once this is sorted, I'll probably look to implement hiding on the lemmy-ui side now that the HTTP PR has merged.

.or(community_follower::person_id.eq(person_id_join)),
);
}
SortType::Hot => query = query.order_by(community_aggregates::hot_rank.desc()),
// Covers all other sorts
_ => query = query.order_by(community_aggregates::users_active_month.desc()),
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is only used for /communities? To be honest I dont understand why it needs this kind of ranking anyway, its not even exposed in lemmy-ui. Though I suppose its also used for the "trending communities" in sidebar.

@Nutomic
Copy link
Member

Nutomic commented Jun 15, 2023

Looks good. Have you tested that it works as expected?

@alexmaras
Copy link
Contributor Author

@Nutomic yep, using it on my instance and it's working great. I'll look at doing another PR to remove the rankings once I've confirmed they're not in use if you like?

@Nutomic Nutomic merged commit becf75d into LemmyNet:main Jun 15, 2023
@Nutomic
Copy link
Member

Nutomic commented Jun 15, 2023

Thanks! The community ranking is used for search, though it doesnt seem to be used by lemmy-ui. I believe trending communities also uses it, but that could switch to use monthly active users instead. Anyway this would be a breaking change so wait until after 0.18 is released.

@alexmaras
Copy link
Contributor Author

Honestly, if you're not fussed either way, I think it's handy for API usage - i.e. if someone wants to use it for apps. I'll work on the community hiding on the lemmy-ui side next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants