mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
In timeline_hide(), also hide the children.
This commit is contained in:
parent
bdc4063b67
commit
3e71f18f34
1 changed files with 10 additions and 1 deletions
11
data.c
11
data.c
|
@ -662,18 +662,27 @@ int timeline_hide(snac *snac, char *id, int hide)
|
|||
xs *s1 = xs_readall(f);
|
||||
xs *msg = xs_json_loads(s1);
|
||||
xs *meta = xs_dup(xs_dict_get(msg, "_snac"));
|
||||
xs *hdn = xs_val_new(hide ? XSTYPE_TRUE : XSTYPE_FALSE);
|
||||
|
||||
fclose(f);
|
||||
|
||||
meta = xs_dict_set(meta, "hidden", xs_val_new(hide ? XSTYPE_TRUE : XSTYPE_FALSE));
|
||||
meta = xs_dict_set(meta, "hidden", hdn);
|
||||
msg = xs_dict_set(msg, "_snac", meta);
|
||||
|
||||
if ((f = fopen(fn, "w")) != NULL) {
|
||||
char *p, *v;
|
||||
xs *j1 = xs_json_dumps_pp(msg, 4);
|
||||
|
||||
fwrite(j1, strlen(j1), 1, f);
|
||||
fclose(f);
|
||||
|
||||
snac_debug(snac, 1, xs_fmt("timeline_hide %d %s", hide, id));
|
||||
|
||||
/* now hide the children */
|
||||
p = xs_dict_get(meta, "children");
|
||||
while (xs_list_iter(&p, &v))
|
||||
timeline_hide(snac, v, hide);
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue