浏览代码

Hide the first child container if it's empty.

default 1 周之前
父节点
当前提交
6f310aff4f
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      html.c

+ 6 - 0
html.c

@@ -2609,6 +2609,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
             const char *cmd5;
             int cnt = 0;
             int o_cnt = 0;
+            int f_cnt = 0;
 
             /* get the first child */
             xs_list_next(children, &cmd5, &ctxt);
@@ -2632,6 +2633,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
                         html_entry(user, f_chd, read_only, level + 1, cmd5, hide_children));
 
                     cnt++;
+                    f_cnt++;
                     left--;
                 }
                 else
@@ -2680,6 +2682,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
             if (o_cnt == 0 && ch_older)
                 xs_html_add(ch_older,
                     xs_html_attr("style", "display: none"));
+
+            if (f_cnt == 0)
+                xs_html_add(fch_container,
+                    xs_html_attr("style", "display: none"));
         }
     }