From 6e8adc86d00dccb9d6569336e6f208226c6bed22 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 8 Jun 2024 21:25:02 +0200 Subject: [PATCH] mastoapi: Added missing field in list creation. --- data.c | 9 +++------ mastoapi.c | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/data.c b/data.c index 183cdb5..2a92e28 100644 --- a/data.c +++ b/data.c @@ -1831,21 +1831,18 @@ xs_val *list_maint(snac *user, const char *list, int op) if (add) { FILE *f; xs *dir = xs_fmt("%s/list/", user->basedir); - xs *id = xs_fmt("%010x", time(NULL)); + + l = xs_fmt("%010x", time(NULL)); mkdirx(dir); - xs *fn = xs_fmt("%s%s.id", dir, id); + xs *fn = xs_fmt("%s%s.id", dir, l); if ((f = fopen(fn, "w")) != NULL) { fprintf(f, "%s\n", list); fclose(f); } - - l = xs_stock(XSTYPE_TRUE); } - else - l = xs_stock(XSTYPE_FALSE); } break; diff --git a/mastoapi.c b/mastoapi.c index 84569e1..7413afa 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -2931,8 +2931,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, if (xs_type(title) == XSTYPE_STRING) { /* add the list */ xs *out = xs_dict_new(); + xs *lid = list_maint(&snac, title, 1); - if (xs_type(list_maint(&snac, title, 1)) == XSTYPE_TRUE) { + if (!xs_is_null(lid)) { + out = xs_dict_append(out, "id", lid); out = xs_dict_append(out, "title", title); out = xs_dict_append(out, "replies_policy", xs_dict_get_def(args, "replies_policy", "list")); out = xs_dict_append(out, "exclusive", xs_stock(XSTYPE_FALSE));