commit ce667ad

grunfink  ·  2025-12-18 07:13:54 +0000 UTC
parent 7c065cb
Fixed some xs_join() uses.
1 files changed,  +12, -7
M html.c
M html.c
+12, -7
 1@@ -72,8 +72,10 @@ xs_str *_replace_shortnames(xs_str *s, const xs_list *tag, int ems,
 2 
 3         xs *style = xs_fmt("max-height: %dem; max-width: %dem;", ems, ems);
 4         xs *class = xs_fmt("snac-emoji snac-emoji-%d-em", ems);
 5-        if (cl)
 6-            class = xs_str_cat(class, " ", xs_join(cl, " "));
 7+        if (cl) {
 8+            xs *l = xs_join(cl, " ");
 9+            class = xs_str_cat(class, " ", l);
10+        }
11 
12         int c = 0;
13         const xs_val *v;
14@@ -2501,9 +2503,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
15                 if (!xs_is_null(nb)) {
16                     is_emoji = 1;
17 
18-                    const char *act = atoi(nb) > 1 ?
19-                        xs_fmt("%d different actors \n\t%s", atoi(nb), xs_join(actors, ",\n\t")) :
20-                        xs_dict_get(m, "actor");
21+                    xs *al = xs_join(actors, ",\n\t");
22+                    xs *act = atoi(nb) > 1 ?
23+                        xs_fmt("%d different actors \n\t%s", atoi(nb), al) :
24+                        xs_dup(xs_dict_get(m, "actor"));
25 
26                     xs *class = xs_list_new();
27                     class = xs_list_append(class, "snac-reaction");
28@@ -2517,6 +2520,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
29                         if (me)
30                             class = xs_list_append(class, "snac-reacted");
31 
32+                        xs *l1 = xs_join(class, " ");
33                         ret = xs_html_tag("button",
34                                 xs_html_attr("type", "submit"),
35                                 xs_html_attr("name", "action"),
36@@ -2526,7 +2530,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
37                                     xs_html_raw(nb),
38                                     xs_html_attr("style", "padding-left: 5px;")),
39                                 xs_html_attr("title", act),
40-                                xs_html_attr("class", xs_join(class, " ")));
41+                                xs_html_attr("class", l1));
42 
43                         if (!(ide && xs_startswith(ide, srv_baseurl)))
44                             xs_html_add(ret, xs_html_attr("disabled", "true"));
45@@ -2540,6 +2544,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
46                             const char *style = "font-size: large;";
47                             if (me)
48                                 class = xs_list_append(class, "snac-reacted");
49+                            xs *l1 = xs_join(class, " ");
50                             ret = xs_html_tag("button",
51                                     xs_html_attr("type", "submit"),
52                                     xs_html_attr("name", "action"),
53@@ -2549,7 +2554,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
54                                         xs_html_raw(nb),
55                                         xs_html_attr("style", "font-size: initial; padding-left: 5px;")),
56                                     xs_html_attr("title", act),
57-                                    xs_html_attr("class", xs_join(class, " ")),
58+                                    xs_html_attr("class", l1),
59                                     xs_html_attr("style", style));
60                         }
61                     }