commit 3e71f18

default  ·  2022-11-21 04:29:35 +0000 UTC
parent bdc4063
In timeline_hide(), also hide the children.
1 files changed,  +10, -1
M data.c
M data.c
+10, -1
 1@@ -662,18 +662,27 @@ int timeline_hide(snac *snac, char *id, int hide)
 2         xs *s1   = xs_readall(f);
 3         xs *msg  = xs_json_loads(s1);
 4         xs *meta = xs_dup(xs_dict_get(msg, "_snac"));
 5+        xs *hdn  = xs_val_new(hide ? XSTYPE_TRUE : XSTYPE_FALSE);
 6 
 7         fclose(f);
 8 
 9-        meta = xs_dict_set(meta, "hidden", xs_val_new(hide ? XSTYPE_TRUE : XSTYPE_FALSE));
10+        meta = xs_dict_set(meta, "hidden", hdn);
11         msg  = xs_dict_set(msg,  "_snac",  meta);
12 
13         if ((f = fopen(fn, "w")) != NULL) {
14+            char *p, *v;
15             xs *j1 = xs_json_dumps_pp(msg, 4);
16 
17             fwrite(j1, strlen(j1), 1, f);
18             fclose(f);
19 
20+            snac_debug(snac, 1, xs_fmt("timeline_hide %d %s", hide, id));
21+
22+            /* now hide the children */
23+            p = xs_dict_get(meta, "children");
24+            while (xs_list_iter(&p, &v))
25+                timeline_hide(snac, v, hide);
26+
27             ret = 1;
28         }
29     }