-
-
Notifications
You must be signed in to change notification settings - Fork 938
Closed
Description
At the moment API responses on main branch look like this (excerpt from /api/v4/community):
{
"community_view": {
"community_actions": {
"community_id": 3,
"person_id": 2,
"followed": "2025-03-24T10:15:47.709074Z",
"follow_state": "Accepted",
"became_moderator": "2025-03-24T10:15:47.705749Z"
},
"instance_actions": null,
"can_mod": true,
...
},
...
}
There are a few problems with this:
- Timestamps for fields like
subscribed,blockedorbecame_moderatorare completely unnecessary. These dont exist in 0.19 and were never requested in any issue. For mod actions the timestamps are stored in the modlog anyway. It is also very unintuitive that clients need to compare with null to find out if a user is moderator or was banned. So these should be changed back to simple booleans. It may even be worth changing the originalsmoosh-tables-togethermigration, as writing bools should be much faster than generating timestamps. - Field names should be simplified to be as before, ie
bannedinstead ofreceived_ban,is_moderatorinstead ofbecame_moderatoretc. - Structs like
instance_actionsare nullable, which makes it impossible to explore the API by browsing the site and observing requests in browser dev tools. This means that client devs need to check the documentation every time, which makes development unnecessarily complicated. We should change it so that if no db rowinstance_actionsexists, a default value is returned with null/false values. - Fields
community_id,person_idetc are unnecessary for clients and can be markedserde(skip), or even completely removed from the Rust structs.
All these changes will make it easier for clients to adopt the new API, and make the migration to 1.0 smoother.