commit 4f0ab18

default  ·  2023-05-24 08:23:57 +0000 UTC
parent 2b6d6d3
Show a ballot box emoji in the score if the enttry it's a poll.
1 files changed,  +11, -3
M html.c
M html.c
+11, -3
 1@@ -745,6 +745,14 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
 2     if (strcmp(actor, snac->actor) != 0 && !valid_status(actor_get(snac, actor, NULL)))
 3         return os;
 4 
 5+    s = xs_str_cat(s, "<div class=\"snac-score\">");
 6+
 7+    if (strcmp(type, "Question") == 0) {
 8+        /* add the ballot box emoji */
 9+        xs *f = xs_fmt("<span title=\"%s\"> &#128499; </span>", L("Poll"));
10+        s = xs_str_cat(s, f);
11+    }
12+
13     /* if this is our post, add the score */
14     if (xs_startswith(id, snac->actor)) {
15         int n_likes  = object_likes_len(id);
16@@ -752,13 +760,13 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
17 
18         /* alternate emojis: %d &#128077; %d &#128257; */
19 
20-        xs *s1 = xs_fmt(
21-            "<div class=\"snac-score\">%d &#9733; %d &#8634;</div>\n",
22-            n_likes, n_boosts);
23+        xs *s1 = xs_fmt("%d &#9733; %d &#8634;\n", n_likes, n_boosts);
24 
25         s = xs_str_cat(s, s1);
26     }
27 
28+    s = xs_str_cat(s, "</div>\n");
29+
30     if (level == 0)
31         s = xs_str_cat(s, "<div class=\"snac-post\">\n");
32     else