commit 1a84c5e

grunfink  ·  2025-07-27 02:23:31 +0000 UTC
parent 2e982c7
mastoapi: the 'approve_followers' toggle can also be set from apps.
1 files changed,  +6, -2
+6, -2
 1@@ -3712,7 +3712,7 @@ int mastoapi_patch_handler(const xs_dict *req, const char *q_path,
 2     snac snac = {0};
 3     int logged_in = process_auth_token(&snac, req);
 4 
 5-    if (xs_startswith(cmd, "/v1/accounts/update_credentials")) {
 6+    if (xs_startswith(cmd, "/v1/accounts/update_credentials")) { /** **/
 7         /* Update user profile fields */
 8         if (logged_in) {
 9             int c = 0;
10@@ -3768,9 +3768,13 @@ int mastoapi_patch_handler(const xs_dict *req, const char *q_path,
11                         snac.config = xs_dict_set(snac.config, "metadata", new_fields);
12                     }
13                 }
14+                else
15+                if (strcmp(k, "locked") == 0) {
16+                    snac.config = xs_dict_set(snac.config, "approve_followers",
17+                        xs_stock(strcmp(v, "true") == 0 ? XSTYPE_TRUE : XSTYPE_FALSE));
18+                }
19                 /* we don't have support for the following options, yet
20                    - discoverable (0/1)
21-                   - locked (0/1)
22                  */
23             }
24