summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2024-12-20 09:45:11 +0100
committerGravatar default2024-12-20 09:45:11 +0100
commit1167b64f8ff4de9a782feba01c67fef9d75ea3a6 (patch)
tree61b240fb8c359cbcbbe78edcdf34b5dcfd5ae8be /mastoapi.c
parentAdd contact metrics to og:description. (diff)
downloadpenes-snac2-1167b64f8ff4de9a782feba01c67fef9d75ea3a6.tar.gz
penes-snac2-1167b64f8ff4de9a782feba01c67fef9d75ea3a6.tar.xz
penes-snac2-1167b64f8ff4de9a782feba01c67fef9d75ea3a6.zip
mastoapi: minor tweak to notification list (Tusky was in a forever request loop).
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c14
1 files changed, 12 insertions, 2 deletions
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,
1805 const char *min_id = xs_dict_get(args, "min_id"); 1805 const char *min_id = xs_dict_get(args, "min_id");
1806 const char *max_id = xs_dict_get(args, "max_id"); 1806 const char *max_id = xs_dict_get(args, "max_id");
1807 1807
1808 if (dbglevel) {
1809 xs *js = xs_json_dumps(args, 0);
1810 srv_debug(1, xs_fmt("mastoapi_notifications args %s", js));
1811 }
1812
1808 xs_list_foreach(l, v) { 1813 xs_list_foreach(l, v) {
1809 xs *noti = notify_get(&snac1, v); 1814 xs *noti = notify_get(&snac1, v);
1810 1815
@@ -1829,8 +1834,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1829 continue; 1834 continue;
1830 1835
1831 if (max_id) { 1836 if (max_id) {
1832 if (strcmp(fid, max_id) > 0) 1837 if (strcmp(fid, max_id) == 0)
1833 continue; 1838 max_id = NULL;
1839
1840 continue;
1834 } 1841 }
1835 1842
1836 if (min_id) { 1843 if (min_id) {
@@ -1886,6 +1893,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1886 out = xs_list_append(out, mn); 1893 out = xs_list_append(out, mn);
1887 } 1894 }
1888 1895
1896 srv_debug(1, xs_fmt("mastoapi_notifications count %d", xs_list_len(out)));
1897
1889 *body = xs_json_dumps(out, 4); 1898 *body = xs_json_dumps(out, 4);
1890 *ctype = "application/json"; 1899 *ctype = "application/json";
1891 status = HTTP_STATUS_OK; 1900 status = HTTP_STATUS_OK;
@@ -3002,6 +3011,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
3002 status = HTTP_STATUS_UNPROCESSABLE_CONTENT; 3011 status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
3003 } 3012 }
3004 } 3013 }
3014 else
3005 if (xs_startswith(cmd, "/v1/lists/")) { /** list maintenance **/ 3015 if (xs_startswith(cmd, "/v1/lists/")) { /** list maintenance **/
3006 if (logged_in) { 3016 if (logged_in) {
3007 xs *l = xs_split(cmd, "/"); 3017 xs *l = xs_split(cmd, "/");