From 1167b64f8ff4de9a782feba01c67fef9d75ea3a6 Mon Sep 17 00:00:00 2001 From: default Date: Fri, 20 Dec 2024 09:45:11 +0100 Subject: mastoapi: minor tweak to notification list (Tusky was in a forever request loop). --- mastoapi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 59b0515..96aa3ac 100644 --- 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, "/"); -- cgit v1.2.3