commit 73b1ef1

default  ·  2023-11-20 19:33:52 +0000 UTC
parent 1ad4a93
html_actor_icon() returns an xs_html.
1 files changed,  +12, -8
M html.c
M html.c
+12, -8
 1@@ -92,7 +92,7 @@ xs_str *actor_name(xs_dict *actor)
 2 }
 3 
 4 
 5-xs_str *html_actor_icon(xs_dict *actor, const char *date,
 6+xs_html *html_actor_icon(xs_dict *actor, const char *date,
 7                         const char *udate, const char *url, int priv)
 8 {
 9     xs_html *actor_icon = xs_html_tag("p", NULL);
10@@ -196,7 +196,7 @@ xs_str *html_actor_icon(xs_dict *actor, const char *date,
11                 xs_html_text(user)));
12     }
13 
14-    return xs_html_render(actor_icon);
15+    return actor_icon;
16 }
17 
18 
19@@ -223,7 +223,8 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg)
20         date  = xs_dict_get(msg, "published");
21         udate = xs_dict_get(msg, "updated");
22 
23-        xs *s1 = html_actor_icon(actor, date, udate, url, priv);
24+        xs_html *actor_icon = html_actor_icon(actor, date, udate, url, priv);
25+        xs *s1 = xs_html_render(actor_icon);
26         os = xs_str_cat(os, s1);
27     }
28 
29@@ -1706,7 +1707,9 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
30             s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n");
31 
32             {
33-                xs *s1 = html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0);
34+                xs_html *actor_icon = html_actor_icon(actor,
35+                    xs_dict_get(actor, "published"), NULL, NULL, 0);
36+                xs *s1 = xs_html_render(actor_icon);
37                 s = xs_str_cat(s, s1, "</div>\n");
38             }
39 
40@@ -1910,11 +1913,12 @@ xs_str *html_notifications(snac *snac)
41         s = xs_str_cat(s, s1);
42 
43         if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) {
44-            s = xs_str_cat(s, "<div class=\"snac-post\">\n");
45+            xs_html *div = xs_html_tag("div",
46+                xs_html_attr("class", "snac-post"),
47+                html_actor_icon(actor, NULL, NULL, NULL, 0));
48 
49-            xs *s1 = html_actor_icon(actor, NULL, NULL, NULL, 0);
50-
51-            s = xs_str_cat(s, s1, "</div>\n");
52+            xs *s1 = xs_html_render(div);
53+            s = xs_str_cat(s, s1);
54         }
55         else {
56             xs *md5 = xs_md5_hex(id, strlen(id));