snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit f2a91d8d4802ae6c6c604af07b2ff98a2a3c2b4f
parent dc9d6520ee90acf0d92fb1b247d6663954e254bf
Author: default <nobody@localhost>
Date:   Tue, 30 May 2023 14:58:41 +0200

Label closed polls correctly in the notification area.

Diffstat:
Mhtml.c | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/html.c b/html.c @@ -1352,8 +1352,9 @@ xs_str *html_notifications(snac *snac) continue; xs *obj = NULL; - const char *type = xs_dict_get(noti, "type"); - const char *id = xs_dict_get(noti, "objid"); + const char *type = xs_dict_get(noti, "type"); + const char *utype = xs_dict_get(noti, "utype"); + const char *id = xs_dict_get(noti, "objid"); if (!valid_status(object_get(id, &obj))) continue; @@ -1390,8 +1391,16 @@ xs_str *html_notifications(snac *snac) s = xs_str_cat(s, "<div>\n"); + const char *label = type; + + if (strcmp(type, "Create") == 0) + label = L("Mention"); + else + if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0) + label = L("Finished poll"); + xs *s1 = xs_fmt("<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n", - strcmp(type, "Create") == 0 ? "Mention" : type, actor_id, a_name); + label, actor_id, a_name); s = xs_str_cat(s, s1); if (strcmp(type, "Follow") == 0) {