html_actor_icon() returns an xs_html.

This commit is contained in:
default 2023-11-20 20:33:52 +01:00
parent 1ad4a93649
commit 73b1ef1599

20
html.c
View file

@ -92,7 +92,7 @@ xs_str *actor_name(xs_dict *actor)
} }
xs_str *html_actor_icon(xs_dict *actor, const char *date, xs_html *html_actor_icon(xs_dict *actor, const char *date,
const char *udate, const char *url, int priv) const char *udate, const char *url, int priv)
{ {
xs_html *actor_icon = xs_html_tag("p", NULL); xs_html *actor_icon = xs_html_tag("p", NULL);
@ -196,7 +196,7 @@ xs_str *html_actor_icon(xs_dict *actor, const char *date,
xs_html_text(user))); xs_html_text(user)));
} }
return xs_html_render(actor_icon); return actor_icon;
} }
@ -223,7 +223,8 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg)
date = xs_dict_get(msg, "published"); date = xs_dict_get(msg, "published");
udate = xs_dict_get(msg, "updated"); udate = xs_dict_get(msg, "updated");
xs *s1 = html_actor_icon(actor, date, udate, url, priv); xs_html *actor_icon = html_actor_icon(actor, date, udate, url, priv);
xs *s1 = xs_html_render(actor_icon);
os = xs_str_cat(os, s1); os = xs_str_cat(os, s1);
} }
@ -1706,7 +1707,9 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n"); s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n");
{ {
xs *s1 = html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0); xs_html *actor_icon = html_actor_icon(actor,
xs_dict_get(actor, "published"), NULL, NULL, 0);
xs *s1 = xs_html_render(actor_icon);
s = xs_str_cat(s, s1, "</div>\n"); s = xs_str_cat(s, s1, "</div>\n");
} }
@ -1910,11 +1913,12 @@ xs_str *html_notifications(snac *snac)
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) { if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) {
s = xs_str_cat(s, "<div class=\"snac-post\">\n"); xs_html *div = xs_html_tag("div",
xs_html_attr("class", "snac-post"),
html_actor_icon(actor, NULL, NULL, NULL, 0));
xs *s1 = html_actor_icon(actor, NULL, NULL, NULL, 0); xs *s1 = xs_html_render(div);
s = xs_str_cat(s, s1);
s = xs_str_cat(s, s1, "</div>\n");
} }
else { else {
xs *md5 = xs_md5_hex(id, strlen(id)); xs *md5 = xs_md5_hex(id, strlen(id));