commit 1167b64f8ff4de9a782feba01c67fef9d75ea3a6
parent 156d5280196c948369b186999a74c7062272b5b2
Author: default <nobody@localhost>
Date: Fri, 20 Dec 2024 09:45:11 +0100
mastoapi: minor tweak to notification list (Tusky was in a forever request loop).
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/mastoapi.c b/mastoapi.c
@@ -1805,6 +1805,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
const char *min_id = xs_dict_get(args, "min_id");
const char *max_id = xs_dict_get(args, "max_id");
+ if (dbglevel) {
+ xs *js = xs_json_dumps(args, 0);
+ srv_debug(1, xs_fmt("mastoapi_notifications args %s", js));
+ }
+
xs_list_foreach(l, v) {
xs *noti = notify_get(&snac1, v);
@@ -1829,8 +1834,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
continue;
if (max_id) {
- if (strcmp(fid, max_id) > 0)
- continue;
+ if (strcmp(fid, max_id) == 0)
+ max_id = NULL;
+
+ continue;
}
if (min_id) {
@@ -1886,6 +1893,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
out = xs_list_append(out, mn);
}
+ srv_debug(1, xs_fmt("mastoapi_notifications count %d", xs_list_len(out)));
+
*body = xs_json_dumps(out, 4);
*ctype = "application/json";
status = HTTP_STATUS_OK;
@@ -3002,6 +3011,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
}
}
+ else
if (xs_startswith(cmd, "/v1/lists/")) { /** list maintenance **/
if (logged_in) {
xs *l = xs_split(cmd, "/");