Minor tweaks.

This commit is contained in:
default 2024-05-31 11:24:39 +02:00
parent f1712dbe5d
commit affab3ab3c
2 changed files with 8 additions and 3 deletions

4
html.c
View File

@ -795,12 +795,14 @@ static xs_html *html_user_body(snac *user, int read_only)
const t_announcement *an = announcement(la);
if (an != NULL && (an->text != NULL)) {
xs *s = xs_fmt("?da=%.0f", an->timestamp);
xs_html_add(top_user, xs_html_tag("div",
xs_html_attr("class", "snac-announcement"),
xs_html_text(an->text),
xs_html_text(" "),
xs_html_sctag("a",
xs_html_attr("href", xs_dup(xs_fmt("?da=%.0f", an->timestamp)))),
xs_html_attr("href", s)),
xs_html_text("Dismiss")));
}

View File

@ -2010,8 +2010,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
const t_announcement *annce = announcement(la);
if (annce != NULL && annce->text != NULL) {
xs *an = xs_dict_new();
an = xs_dict_set(an, "id", xs_fmt("%d", annce->timestamp));
an = xs_dict_set(an, "content", xs_fmt("<p>%s</p>", annce->text));
xs *id = xs_fmt("%d", annce->timestamp);
xs *ct = xs_fmt("<p>%s</p>", annce->text);
an = xs_dict_set(an, "id", id);
an = xs_dict_set(an, "content", ct);
an = xs_dict_set(an, "starts_at", xs_stock(XSTYPE_NULL));
an = xs_dict_set(an, "ends_at", xs_stock(XSTYPE_NULL));
an = xs_dict_set(an, "all_day", xs_stock(XSTYPE_TRUE));