[feature] Page through accounts as moderator (#2881)

* [feature] Page through accounts as moderator

* aaaaa

* use COLLATE "C" for Postgres to ensure same ordering as SQLite

* fix typo, test paging up

* don't show moderation / info for our instance acct
This commit is contained in:
tobi
2024-05-01 15:11:22 +02:00
committed by GitHub
parent 1edcb06afe
commit 725a21b027
30 changed files with 1473 additions and 432 deletions

View File

@@ -19,11 +19,13 @@
//
// View + page through known accounts according to given filters.
//
// Returned accounts will be ordered alphabetically (a-z) by domain + username.
//
// The next and previous queries can be parsed from the returned Link header.
// Example:
//
// ```
// <https://example.org/api/v1/admin/accounts?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/admin/accounts?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
// <https://example.org/api/v1/admin/accounts?limit=80&max_id=example.org%2F%40someone>; rel="next", <https://example.org/api/v1/admin/accounts?limit=80&min_id=example.org%2F%40someone_else>; rel="prev"
// ````
//
// ---
@@ -117,23 +119,30 @@
// name: max_id
// in: query
// type: string
// description: All results returned will be older than the item with this ID.
// -
// name: since_id
// in: query
// type: string
// description: All results returned will be newer than the item with this ID.
// description: >-
// max_id in the form `[domain]/@[username]`.
// All results returned will be later in the alphabet than `[domain]/@[username]`.
// For example, if max_id = `example.org/@someone` then returned entries might
// contain `example.org/@someone_else`, `later.example.org/@someone`, etc.
// Local account IDs in this form use an empty string for the `[domain]` part,
// for example local account with username `someone` would be `/@someone`.
// -
// name: min_id
// in: query
// type: string
// description: Returns results immediately newer than the item with this ID.
// description: >-
// min_id in the form `[domain]/@[username]`.
// All results returned will be earlier in the alphabet than `[domain]/@[username]`.
// For example, if min_id = `example.org/@someone` then returned entries might
// contain `example.org/@earlier_account`, `earlier.example.org/@someone`, etc.
// Local account IDs in this form use an empty string for the `[domain]` part,
// for example local account with username `someone` would be `/@someone`.
// -
// name: limit
// in: query
// type: integer
// description: Maximum number of results to return.
// default: 100
// default: 50
// maximum: 200
// minimum: 1
//
@@ -200,7 +209,7 @@ func (m *Module) AccountsGETV1Handler(c *gin.Context) {
return
}
page, errWithCode := paging.ParseIDPage(c, 1, 200, 100)
page, errWithCode := paging.ParseIDPage(c, 1, 200, 50)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return