lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Add paging to the `GetBannedPersons` fetch.

Open dessalines opened this issue 2 years ago • 2 comments

Currently GetBannedPersons fetches all banned users. It would be more performant if paging were added to this endpoint.

Not a huge deal, since this is only available to admins anyway.

dessalines avatar May 09 '23 15:05 dessalines

See https://github.com/LemmyNet/lemmy/pull/4580 for an example how to implement this.

Nutomic avatar Sep 20 '24 12:09 Nutomic

Also, we'd like to convert every existing page and limit to cursor pagination, like list_posts . But I'd need @dullbananas expertise on how to do that correctly.

dessalines avatar Sep 20 '24 14:09 dessalines

When doing this I would change the endpoint to /api/v4/person/list with parameter banned_only. It only requires slightly more work, fulfills the same purpose and can later be extended with more optional parameters.

Nutomic avatar Feb 13 '25 09:02 Nutomic

Hrm. So far the only two person fetches are listing admins, and listing banned persons, and only banned_persons is its own endpoint. Search can also list persons, but it already has pagination.

I think this is one case where I'd prefer specific endpoints, rather than a multi-purpose generic one, because we only have one case of person fetching, and /admin/banned is pretty clear.

I will make person_view.rs a bit more generic tho now, by adding a PersonQuery, with admin_only, banned_only, and pagination.

dessalines avatar Feb 14 '25 16:02 dessalines

I dont see any reason why banned users should be a separate endpoint, its better to do like GetPosts with various filters (banned_only, local_only etc). This has been frequently requested (eg https://github.com/LemmyNet/lemmy/issues/4419) and would be very useful for small instances. Other frontends could already implement a full user list display with that basic endpoint, and later it could be extended with more filters and sort options. Afaik lemmy-ui only shows the banned users list under /admin which would work just as well with a general user list and banned_only filter.

Nutomic avatar Feb 17 '25 13:02 Nutomic

Alright, as long as its under the admin heading, that'll probably be fine.

dessalines avatar Feb 17 '25 14:02 dessalines