commit dfa0911

Louis Brauer  ·  2024-05-27 17:46:35 +0000 UTC
parent 26fbda7
Implement empty response for /accounts/:id/featured_tags
1 files changed,  +17, -2
+17, -2
 1@@ -1443,6 +1443,14 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2                         }
 3                     }
 4                 }
 5+                else
 6+                if (strcmp(opt, "featured_tags") == 0) {
 7+                    /* snac doesn't have features tags, yet? */
 8+                    /* implement empty response so apps like Tokodon don't show an error */
 9+                    *body  = xs_dup("[]");
10+                    *ctype = "application/json";
11+                    status = HTTP_STATUS_OK;
12+                }
13 
14                 user_free(&snac2);
15             }
16@@ -1455,9 +1463,16 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
17                     }
18                     else
19                     if (strcmp(opt, "statuses") == 0) {
20-                        /* we don't serve statuses of others; return the empty list */
21+                        /* we don't serve statuses of others; return the empty list */ 
22                         out = xs_list_new();
23                     }
24+                    if (strcmp(opt, "featured_tags") == 0) {
25+                        /* snac doesn't have features tags, yet? */
26+                        /* implement empty response so apps like Tokodon don't show an error */
27+                        *body  = xs_dup("[]");
28+                        *ctype = "application/json";
29+                        status = HTTP_STATUS_OK;
30+                    }
31                 }
32             }
33 
34@@ -2031,7 +2046,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
35                 "\"max_characters\":100000,\"max_media_attachments\":8}");
36             cfg = xs_dict_append(cfg, "statuses", d11);
37 
38-            xs *d12 = xs_json_loads("{\"max_featured_tags\":10}");
39+            xs *d12 = xs_json_loads("{\"max_featured_tags\":0}");
40             cfg = xs_dict_append(cfg, "accounts", d12);
41 
42             xs *d13 = xs_json_loads("{\"image_matrix_limit\":33177600,"