commit a64a25a

default  ·  2023-04-14 11:32:37 +0000 UTC
parent a050be9
More notification web tweaks.
1 files changed,  +12, -2
M html.c
M html.c
+12, -2
 1@@ -287,7 +287,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
 2             int n_len  = xs_list_len(n_list);
 3             xs *n_str  = NULL;
 4 
 5-            /* show the notification number, if there are any */
 6+            /* show the number of new notifications, if there are any */
 7             if (n_len)
 8                 n_str = xs_fmt("<sup style=\"background-color: red; "
 9                                "color: white;\"> %d </sup> ", n_len);
10@@ -1215,6 +1215,14 @@ xs_str *html_notifications(snac *snac)
11         if (is_hidden(snac, id))
12             continue;
13 
14+        const char *actor_id = xs_dict_get(noti, "actor");
15+        xs *actor = NULL;
16+
17+        if (!valid_status(object_get(actor_id, &actor)))
18+            continue;
19+
20+        xs *a_name = actor_name(actor);
21+
22         if (strcmp(v, n_time) > 0) {
23             /* unseen notification */
24             if (stage == NHDR_NONE) {
25@@ -1236,7 +1244,8 @@ xs_str *html_notifications(snac *snac)
26 
27         s = xs_str_cat(s, "<div>\n");
28 
29-        xs *s1 = xs_fmt("<p><b>%s</b>:</p>\n", strcmp(type, "Create") == 0 ? "Mention" : type);
30+        xs *s1 = xs_fmt("<p>%s by <a href=\"%s\">%s</a>:</p>\n",
31+            strcmp(type, "Create") == 0 ? "Mention" : type, actor_id, a_name);
32         s = xs_str_cat(s, s1);
33 
34         if (strcmp(type, "Follow") == 0) {
35@@ -1248,6 +1257,7 @@ xs_str *html_notifications(snac *snac)
36         }
37         else {
38             xs *md5 = xs_md5_hex(id, strlen(id));
39+
40             s = html_entry(snac, s, obj, 0, 0, md5, 1);
41         }
42