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

Add sort order parameter to moderation report endpoints #4581

Open
5 tasks done
EricBAndrews opened this issue Apr 2, 2024 · 1 comment
Open
5 tasks done

Add sort order parameter to moderation report endpoints #4581

EricBAndrews opened this issue Apr 2, 2024 · 1 comment

Comments

@EricBAndrews
Copy link

EricBAndrews commented Apr 2, 2024

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 put multiple feature requests in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
  • Do you agree to follow the rules in our Code of Conduct?

Is your proposal related to a problem?

Currently, post reports, comment reports, and registration applications sort by publication date in descending order by default and in ascending order when unresolved_only is true, while private message reports are always returned in descending order by publication date of the message itself. This renders it impossible to display a sorted feed of all unresolved reports.

Describe the solution you'd like.

I propose adding an ascending/descending sort_order parameter to the API endpoint that, if present, overrides the default sorting behavior with the specified ordering.

Describe alternatives you've considered.

  • Sort client-side: possible for the first page, but sorting issues emerge on later pages. Re-sorting every page fetch is infeasible as new items will be inserted at the top of the feed, out of the user's sight.
  • Fetch all (or a large number of) items and filter client-side: slow and bad API citizenship

Additional context

No response

@dessalines
Copy link
Member

while private message reports are always returned in descending order by publication date of the message itself.

That seems to be the main bug here. The sorting logic in the code is:

If viewing all reports, order by newest, but if viewing unresolved only, show the oldest first (FIFO)

I don't know if we'd want to complicate that logic by moving it client side. Probably best to not have a sort parameter, and let the back end apply the above rule.

Combining these types and properly sorting them is limited by #2444 . Because rn they could have wildly different time ranges.

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

No branches or pull requests

3 participants