commit 6e8adc8

default  ·  2024-06-08 19:25:02 +0000 UTC
parent bbb365e
mastoapi: Added missing field in list creation.
2 files changed,  +6, -7
M data.c
M data.c
+3, -6
 1@@ -1831,21 +1831,18 @@ xs_val *list_maint(snac *user, const char *list, int op)
 2             if (add) {
 3                 FILE *f;
 4                 xs *dir = xs_fmt("%s/list/", user->basedir);
 5-                xs *id  = xs_fmt("%010x", time(NULL));
 6+
 7+                l = xs_fmt("%010x", time(NULL));
 8 
 9                 mkdirx(dir);
10 
11-                xs *fn = xs_fmt("%s%s.id", dir, id);
12+                xs *fn = xs_fmt("%s%s.id", dir, l);
13 
14                 if ((f = fopen(fn, "w")) != NULL) {
15                     fprintf(f, "%s\n", list);
16                     fclose(f);
17                 }
18-
19-                l = xs_stock(XSTYPE_TRUE);
20             }
21-            else
22-                l = xs_stock(XSTYPE_FALSE);
23         }
24 
25         break;
+3, -1
 1@@ -2931,8 +2931,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
 2             if (xs_type(title) == XSTYPE_STRING) {
 3                 /* add the list */
 4                 xs *out = xs_dict_new();
 5+                xs *lid = list_maint(&snac, title, 1);
 6 
 7-                if (xs_type(list_maint(&snac, title, 1)) == XSTYPE_TRUE) {
 8+                if (!xs_is_null(lid)) {
 9+                    out = xs_dict_append(out, "id", lid);
10                     out = xs_dict_append(out, "title", title);
11                     out = xs_dict_append(out, "replies_policy", xs_dict_get_def(args, "replies_policy", "list"));
12                     out = xs_dict_append(out, "exclusive", xs_stock(XSTYPE_FALSE));