commit 3fb0a0a
Louis Brauer
·
2024-06-06 22:57:33 +0000 UTC
parent d668fdd
mastoapi: fix create list response & duplicate actor adding
2 files changed,
+6,
-4
M
data.c
M
data.c
+1,
-1
1@@ -1925,7 +1925,7 @@ xs_val *list_content(snac *user, const char *list, const char *actor_md5, int op
2
3 case 1: /** append actor to list **/
4 if (actor_md5 != NULL) {
5- if (!index_in(fn, actor_md5))
6+ if (!index_in_md5(fn, actor_md5))
7 index_add_md5(fn, actor_md5);
8 }
9
+5,
-3
1@@ -1974,7 +1974,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2 d = xs_dict_append(d, "replies_policy", "list");
3 d = xs_dict_append(d, "exclusive", xs_stock(XSTYPE_FALSE));
4
5- out = xs_list_append(out, d);
6+ out = xs_dup(d);
7 break;
8 }
9 }
10@@ -2971,8 +2971,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
11 list_content(&snac, id, v, 1);
12 }
13
14- *ctype = "application/json";
15- status = HTTP_STATUS_OK;
16+ xs *out = xs_dict_new();
17+ *body = xs_json_dumps(out, 4);
18+ *ctype = "application/json";
19+ status = HTTP_STATUS_OK;
20 }
21 }
22 }