commit 1167b64

default  ·  2024-12-20 08:45:11 +0000 UTC
parent 156d528
mastoapi: minor tweak to notification list (Tusky was in a forever request loop).
1 files changed,  +12, -2
+12, -2
 1@@ -1805,6 +1805,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2             const char *min_id = xs_dict_get(args, "min_id");
 3             const char *max_id = xs_dict_get(args, "max_id");
 4 
 5+            if (dbglevel) {
 6+                xs *js = xs_json_dumps(args, 0);
 7+                srv_debug(1, xs_fmt("mastoapi_notifications args %s", js));
 8+            }
 9+
10             xs_list_foreach(l, v) {
11                 xs *noti = notify_get(&snac1, v);
12 
13@@ -1829,8 +1834,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
14                     continue;
15 
16                 if (max_id) {
17-                    if (strcmp(fid, max_id) > 0)
18-                        continue;
19+                    if (strcmp(fid, max_id) == 0)
20+                        max_id = NULL;
21+
22+                    continue;
23                 }
24 
25                 if (min_id) {
26@@ -1886,6 +1893,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
27                 out = xs_list_append(out, mn);
28             }
29 
30+            srv_debug(1, xs_fmt("mastoapi_notifications count %d", xs_list_len(out)));
31+
32             *body  = xs_json_dumps(out, 4);
33             *ctype = "application/json";
34             status = HTTP_STATUS_OK;
35@@ -3002,6 +3011,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
36                 status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
37         }
38     }
39+    else
40     if (xs_startswith(cmd, "/v1/lists/")) { /** list maintenance **/
41         if (logged_in) {
42             xs *l = xs_split(cmd, "/");