Requirements Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support Did you check to see if this issue already exists? Is this only a feature request? Do not p...
[X] Did you check to see if this issue already exists?
[X] Is this only a feature request? Do not put multiple feature requests in one issue.
[X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Is your proposal related to a problem?
In the web UI, when visiting the /communities page, I would like the ability to sort by clicking the column headers. I believe this may be a backend issue, though, as I can't seem to supply any sort values in the API call to /community/list that have the effect I want.
I have never written any Rust before, so feel free to tell me I have no idea what I'm talking about, but it would appear that the sort URL parameter just gets passed straight to the query builder. This request type is defined here as a SortType, which is defined as an enum here. The values in that enum do not correspond to much of the data in the counts section of the /community/list response, making me think the sorting is ultimately ignored.
Furthermore, if I query the server with &sort=Hot one might think that the results would be sorted by their hot_rank, but this does not appear to be the case.
Again, if I'm off base here, please point me in the right direction.
Describe the solution you'd like.
Seems the solution is to implement listing communities sorted by various count values in the API, then to expose the new sorting features through the lemmy-ui project.
Describe alternatives you've considered.
I have used the tools at https://lemmyverse.net/ to get to the data I want. There I can filter down to my instance, view its communities, and sort by things like subscriber count and activity and so on.
This is already a feature in the backend as you can see here and verify by using Hoppscotch or similar:
Make a request to https://lemmy.world/api/v3/community/list and skim through the results. Then make a result with sort set to TopAll and verify that the results seem to be sorted by subscriber count, as the linked code would dictate.
I'm new to the Lemmy code base so I may be wrong on the exact spot, but it seems to me that the issue is in lemmy-ui, not lemmy, as here sort is not considered as a parameter. Further, it appears that the API client the webapp uses, lemmy-js-client, already includes support for sorting since I believe the types there are automatically derived from the Rust types in this repo.
So really this is an issue with lemmy-ui, which would need to add a selector for the sort and support for the query parameter.
Edit: Decided to just go ahead and add the search bar myself.