aboutsummaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorshtrophic <christoph@liebender.dev>2025-03-20 22:54:56 +0100
committershtrophic <christoph@liebender.dev>2025-03-20 22:54:56 +0100
commit0aeebc177f7f40cd583c65a085c51a9398995135 (patch)
tree7d4c79b675b612ffd16b645f2014dfc9c231c25c /html.c
parent398b733b2c0ff4c96f4de9731a864373842e86d6 (diff)
parentbd9e9b71d7e039cc2ed971b5f2d54e6553440210 (diff)
Merge tag '2.74' into curl-smtp
Version 2.74 RELEASED.
Diffstat (limited to 'html.c')
-rw-r--r--html.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/html.c b/html.c
index a90a51f..78a9854 100644
--- a/html.c
+++ b/html.c
@@ -92,6 +92,7 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
xs_html *img = xs_html_sctag("img",
xs_html_attr("loading", "lazy"),
xs_html_attr("src", url),
+ xs_html_attr("alt", n),
xs_html_attr("style", style));
xs *s1 = xs_html_render(img);
@@ -2584,6 +2585,12 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
xs_html_add(entry,
ch_details);
+ xs_html *fch_container = xs_html_tag("div",
+ xs_html_attr("class", "snac-thread-cont"));
+
+ xs_html_add(ch_details,
+ fch_container);
+
xs_html *ch_container = xs_html_tag("div",
xs_html_attr("class", level < 4 ? "snac-children" : "snac-children-too-deep"));
@@ -2598,12 +2605,42 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
xs_html_text(L("Older...")))));
}
- xs_list *p = children;
+ int ctxt = 0;
const char *cmd5;
int cnt = 0;
int o_cnt = 0;
+ int f_cnt = 0;
+
+ /* get the first child */
+ xs_list_next(children, &cmd5, &ctxt);
+ xs *f_chd = NULL;
+
+ if (user)
+ timeline_get_by_md5(user, cmd5, &f_chd);
+ else
+ object_get_by_md5(cmd5, &f_chd);
+
+ if (f_chd != NULL && xs_is_null(xs_dict_get(f_chd, "name"))) {
+ const char *p_author = get_atto(msg);
+ const char *author = get_atto(f_chd);
+
+ /* is the first child from the same author? */
+ if (xs_is_string(p_author) && xs_is_string(author) && strcmp(p_author, author) == 0) {
+ /* then, don't add it to the children container,
+ so that it appears unindented just before the parent
+ like a fucking Twitter-like thread */
+ xs_html_add(fch_container,
+ html_entry(user, f_chd, read_only, level + 1, cmd5, hide_children));
- while (xs_list_iter(&p, &cmd5)) {
+ cnt++;
+ f_cnt++;
+ left--;
+ }
+ else
+ ctxt = 0; /* restart from the beginning */
+ }
+
+ while (xs_list_next(children, &cmd5, &ctxt)) {
xs *chd = NULL;
if (user)
@@ -2645,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"));
}
}