diff options
author | 2024-07-31 09:26:09 -0700 | |
---|---|---|
committer | 2024-07-31 09:26:09 -0700 | |
commit | fd837776e2aaf30f4ea973d65c9dfe0979988371 (patch) | |
tree | c2853d4bab55e1eccd91cbf48df4dd6279bc72d7 /internal/api/client/admin/accountsgetv2_test.go | |
parent | [docs] Update system requirements, move things around a bit (#3157) (diff) | |
download | gotosocial-fd837776e2aaf30f4ea973d65c9dfe0979988371.tar.xz |
[feature] Implement Mastodon-compatible roles (#3136)
* Implement Mastodon-compatible roles
- `Account.role` should only be available through verify_credentials for checking current user's permissions
- `Account.role` now carries a Mastodon-compatible permissions bitmap and a marker for whether it should be shown to the public
- `Account.roles` added for *public* display roles (undocumented but stable since Mastodon 4.1)
- Web template now uses only public display roles (no user-visible change here, we already special-cased the `user` role)
* Handle verify_credentials case for default role
* Update JSON exact-match tests
* Address review comments
* Add blocks bit to admin permissions bitmap
Diffstat (limited to 'internal/api/client/admin/accountsgetv2_test.go')
-rw-r--r-- | internal/api/client/admin/accountsgetv2_test.go | 85 |
1 files changed, 60 insertions, 25 deletions
diff --git a/internal/api/client/admin/accountsgetv2_test.go b/internal/api/client/admin/accountsgetv2_test.go index 15eb8534b..83f394803 100644 --- a/internal/api/client/admin/accountsgetv2_test.go +++ b/internal/api/client/admin/accountsgetv2_test.go @@ -70,7 +70,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "en", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": true, "approved": true, @@ -109,10 +113,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "verified_at": null } ], - "hide_collections": true, - "role": { - "name": "user" - } + "hide_collections": true }, "created_by_application_id": "01F8MGY43H3N2C8EWPR2FPYEXG" }, @@ -127,7 +128,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "en", "invite_request": null, "role": { - "name": "admin" + "id": "admin", + "name": "admin", + "color": "", + "permissions": "546033", + "highlighted": true }, "confirmed": true, "approved": true, @@ -156,9 +161,13 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "emojis": [], "fields": [], "enable_rss": true, - "role": { - "name": "admin" - } + "roles": [ + { + "id": "admin", + "name": "admin", + "color": "" + } + ] }, "created_by_application_id": "01F8MGXQRHYF5QPMTMXP78QC2F" }, @@ -173,7 +182,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, @@ -214,7 +227,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "en", "invite_request": "I wanna be on this damned webbed site so bad! Please! Wow", "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": true, "approved": true, @@ -244,10 +261,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "last_status_at": "2024-01-10T09:24:00.000Z", "emojis": [], "fields": [], - "enable_rss": true, - "role": { - "name": "user" - } + "enable_rss": true }, "created_by_application_id": "01F8MGY43H3N2C8EWPR2FPYEXG" }, @@ -262,7 +276,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "en", "invite_request": "hi, please let me in! I'm looking for somewhere neato bombeato to hang out.", "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, @@ -289,10 +307,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "statuses_count": 0, "last_status_at": null, "emojis": [], - "fields": [], - "role": { - "name": "user" - } + "fields": [] }, "created_by_application_id": "01F8MGY43H3N2C8EWPR2FPYEXG" }, @@ -307,7 +322,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, @@ -348,7 +367,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, @@ -389,7 +412,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, @@ -431,7 +458,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "locale": "", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, @@ -511,7 +542,11 @@ func (suite *AccountsGetTestSuite) TestAccountsMinID() { "locale": "", "invite_request": null, "role": { - "name": "user" + "id": "user", + "name": "user", + "color": "", + "permissions": "0", + "highlighted": false }, "confirmed": false, "approved": false, |