mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
mastoapi: Added missing field in list creation.
This commit is contained in:
parent
bbb365e81b
commit
6e8adc86d0
2 changed files with 6 additions and 7 deletions
9
data.c
9
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;
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue