snac2

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

commit a64a25a551112d874c36f4fe35e9c38b5f453426
parent a050be91079e5c65589d57e9e00421345d113ac9
Author: default <nobody@localhost>
Date:   Fri, 14 Apr 2023 13:32:37 +0200

More notification web tweaks.

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

diff --git a/html.c b/html.c @@ -287,7 +287,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local) int n_len = xs_list_len(n_list); xs *n_str = NULL; - /* show the notification number, if there are any */ + /* show the number of new notifications, if there are any */ if (n_len) n_str = xs_fmt("<sup style=\"background-color: red; " "color: white;\"> %d </sup> ", n_len); @@ -1215,6 +1215,14 @@ xs_str *html_notifications(snac *snac) if (is_hidden(snac, id)) continue; + const char *actor_id = xs_dict_get(noti, "actor"); + xs *actor = NULL; + + if (!valid_status(object_get(actor_id, &actor))) + continue; + + xs *a_name = actor_name(actor); + if (strcmp(v, n_time) > 0) { /* unseen notification */ if (stage == NHDR_NONE) { @@ -1236,7 +1244,8 @@ xs_str *html_notifications(snac *snac) s = xs_str_cat(s, "<div>\n"); - xs *s1 = xs_fmt("<p><b>%s</b>:</p>\n", strcmp(type, "Create") == 0 ? "Mention" : type); + xs *s1 = xs_fmt("<p>%s by <a href=\"%s\">%s</a>:</p>\n", + strcmp(type, "Create") == 0 ? "Mention" : type, actor_id, a_name); s = xs_str_cat(s, s1); if (strcmp(type, "Follow") == 0) { @@ -1248,6 +1257,7 @@ xs_str *html_notifications(snac *snac) } else { xs *md5 = xs_md5_hex(id, strlen(id)); + s = html_entry(snac, s, obj, 0, 0, md5, 1); }