summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@noreply.codeberg.org>2024-06-07 07:03:15 +0000
committergrunfink <grunfink@noreply.codeberg.org>2024-06-07 07:03:15 +0000
commitaba3c7b50e2e2255432881ed0fd6077be0df04bb (patch)
tree6ad7d8a54239287a8c69b18250b4dfed0a2578bf
parentd668fddd2fc9ebb9a5fdf20103ba7d4f876ed508 (diff)
parent3fb0a0acf0921f147e70dbc88e59ebe59d6a9703 (diff)
Merge pull request 'mastoapi: fix get list response & duplicate actor adding' (#180) from louis77/snac2:fix-lists into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/180
-rw-r--r--data.c2
-rw-r--r--mastoapi.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/data.c b/data.c
index 3e2dffb..183cdb5 100644
--- a/data.c
+++ b/data.c
@@ -1925,7 +1925,7 @@ xs_val *list_content(snac *user, const char *list, const char *actor_md5, int op
case 1: /** append actor to list **/
if (actor_md5 != NULL) {
- if (!index_in(fn, actor_md5))
+ if (!index_in_md5(fn, actor_md5))
index_add_md5(fn, actor_md5);
}
diff --git a/mastoapi.c b/mastoapi.c
index a129ad0..bc86f6d 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1974,7 +1974,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
d = xs_dict_append(d, "replies_policy", "list");
d = xs_dict_append(d, "exclusive", xs_stock(XSTYPE_FALSE));
- out = xs_list_append(out, d);
+ out = xs_dup(d);
break;
}
}
@@ -2971,8 +2971,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
list_content(&snac, id, v, 1);
}
- *ctype = "application/json";
- status = HTTP_STATUS_OK;
+ xs *out = xs_dict_new();
+ *body = xs_json_dumps(out, 4);
+ *ctype = "application/json";
+ status = HTTP_STATUS_OK;
}
}
}