commit affab3a

default  ·  2024-05-31 09:24:39 +0000 UTC
parent f1712db
Minor tweaks.
2 files changed,  +8, -3
M html.c
M html.c
+3, -1
 1@@ -795,12 +795,14 @@ static xs_html *html_user_body(snac *user, int read_only)
 2 
 3     const t_announcement *an = announcement(la);
 4     if (an != NULL && (an->text != NULL)) {
 5+        xs *s = xs_fmt("?da=%.0f", an->timestamp);
 6+
 7         xs_html_add(top_user,  xs_html_tag("div",
 8             xs_html_attr("class", "snac-announcement"),
 9                 xs_html_text(an->text),
10                 xs_html_text(" "),
11                 xs_html_sctag("a",
12-                        xs_html_attr("href", xs_dup(xs_fmt("?da=%.0f", an->timestamp)))),
13+                        xs_html_attr("href", s)),
14                         xs_html_text("Dismiss")));
15     }
16 
+5, -2
 1@@ -2010,8 +2010,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2             const t_announcement *annce = announcement(la);
 3             if (annce != NULL && annce->text != NULL) {
 4                 xs *an = xs_dict_new();
 5-                an = xs_dict_set(an, "id",           xs_fmt("%d", annce->timestamp));
 6-                an = xs_dict_set(an, "content",      xs_fmt("<p>%s</p>", annce->text));
 7+                xs *id = xs_fmt("%d", annce->timestamp);
 8+                xs *ct = xs_fmt("<p>%s</p>", annce->text);
 9+
10+                an = xs_dict_set(an, "id",           id);
11+                an = xs_dict_set(an, "content",      ct);
12                 an = xs_dict_set(an, "starts_at",    xs_stock(XSTYPE_NULL));
13                 an = xs_dict_set(an, "ends_at",      xs_stock(XSTYPE_NULL));
14                 an = xs_dict_set(an, "all_day",      xs_stock(XSTYPE_TRUE));