From 7236e15e8c9ade3d6950558d593de1d457a76c18 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 21 Nov 2023 11:26:45 +0100 Subject: [PATCH] More refactoring of html_people_list(). --- html.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/html.c b/html.c index 609dd0b..6873e5a 100644 --- a/html.c +++ b/html.c @@ -1718,16 +1718,11 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head xs *actor = NULL; if (valid_status(actor_get(actor_id, &actor))) { - s = xs_str_cat(s, "
\n"); - - xs_html *snac_post_header = xs_html_tag("div", - xs_html_attr("class", "snac-post-header"), - html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0)); - - { - xs *s1 = xs_html_render(snac_post_header); - s = xs_str_cat(s, s1); - } + xs_html *snac_post = xs_html_tag("div", + xs_html_attr("class", "snac-post"), + xs_html_tag("div", + xs_html_attr("class", "snac-post-header"), + html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0))); /* content (user bio) */ char *c = xs_dict_get(actor, "summary"); @@ -1746,16 +1741,13 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head xs_html_tag("p", xs_html_raw(sc))); /* already sanitized */ - { - xs *s1 = xs_html_render(snac_content); - s = xs_str_cat(s, s1); - } + xs_html_add(snac_post, snac_content); } /* buttons */ xs *btn_form_action = xs_fmt("%s/admin/action", snac->actor); - xs_html *snac_controls = xs_html_tag("DIV", + xs_html *snac_controls = xs_html_tag("div", xs_html_attr("class", "snac-controls")); xs_html *form = xs_html_tag("form", @@ -1849,12 +1841,12 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head xs_html_add(snac_controls, dm_textarea); + xs_html_add(snac_post, snac_controls); + { - xs *s1 = xs_html_render(snac_controls); + xs *s1 = xs_html_render(snac_post); s = xs_str_cat(s, s1); } - - s = xs_str_cat(s, "
\n"); } }