summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2025-03-17 19:58:17 +0100
committerGravatar default2025-03-17 19:58:17 +0100
commit83c2888a12fb4b3cedff0a8c033532e622f74d8c (patch)
tree0c7b59af6b47c053bf6cfcbcb82f167fbbe8fc4a /html.c
parentUpdated RELEASE_NOTES. (diff)
downloadpenes-snac2-83c2888a12fb4b3cedff0a8c033532e622f74d8c.tar.gz
penes-snac2-83c2888a12fb4b3cedff0a8c033532e622f74d8c.tar.xz
penes-snac2-83c2888a12fb4b3cedff0a8c033532e622f74d8c.zip
If a child post is from the same author, don't indent it.
Diffstat (limited to 'html.c')
-rw-r--r--html.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/html.c b/html.c
index a56b523..fe3b4a1 100644
--- a/html.c
+++ b/html.c
@@ -2585,6 +2585,12 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2585 xs_html_add(entry, 2585 xs_html_add(entry,
2586 ch_details); 2586 ch_details);
2587 2587
2588 xs_html *fch_container = xs_html_tag("div",
2589 xs_html_attr("class", "snac-thread-cont"));
2590
2591 xs_html_add(ch_details,
2592 fch_container);
2593
2588 xs_html *ch_container = xs_html_tag("div", 2594 xs_html *ch_container = xs_html_tag("div",
2589 xs_html_attr("class", level < 4 ? "snac-children" : "snac-children-too-deep")); 2595 xs_html_attr("class", level < 4 ? "snac-children" : "snac-children-too-deep"));
2590 2596
@@ -2599,12 +2605,40 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2599 xs_html_text(L("Older..."))))); 2605 xs_html_text(L("Older...")))));
2600 } 2606 }
2601 2607
2602 xs_list *p = children; 2608 int ctxt = 0;
2603 const char *cmd5; 2609 const char *cmd5;
2604 int cnt = 0; 2610 int cnt = 0;
2605 int o_cnt = 0; 2611 int o_cnt = 0;
2606 2612
2607 while (xs_list_iter(&p, &cmd5)) { 2613 /* get the first child */
2614 xs_list_next(children, &cmd5, &ctxt);
2615 xs *f_chd = NULL;
2616
2617 if (user)
2618 timeline_get_by_md5(user, cmd5, &f_chd);
2619 else
2620 object_get_by_md5(cmd5, &f_chd);
2621
2622 if (f_chd != NULL && xs_is_null(xs_dict_get(f_chd, "name"))) {
2623 const char *p_author = get_atto(msg);
2624 const char *author = get_atto(f_chd);
2625
2626 /* is the first child from the same author? */
2627 if (xs_is_string(p_author) && xs_is_string(author) && strcmp(p_author, author) == 0) {
2628 /* then, don't add it to the children container,
2629 so that it appears unindented just before the parent
2630 like a fucking Twitter-like thread */
2631 xs_html_add(fch_container,
2632 html_entry(user, f_chd, read_only, level + 1, cmd5, hide_children));
2633
2634 cnt++;
2635 left--;
2636 }
2637 else
2638 ctxt = 0; /* restart from the beginning */
2639 }
2640
2641 while (xs_list_next(children, &cmd5, &ctxt)) {
2608 xs *chd = NULL; 2642 xs *chd = NULL;
2609 2643
2610 if (user) 2644 if (user)