commit 5563a41

default  ·  2024-01-31 07:18:50 +0000 UTC
parent 644138b
Added the date to each notification.
1 files changed,  +9, -1
M html.c
M html.c
+9, -1
 1@@ -2163,6 +2163,7 @@ xs_str *html_notifications(snac *user)
 2         char *type  = xs_dict_get(noti, "type");
 3         char *utype = xs_dict_get(noti, "utype");
 4         char *id    = xs_dict_get(noti, "objid");
 5+        char *date  = xs_dict_get(noti, "date");
 6 
 7         if (xs_is_null(id) || !valid_status(object_get(id, &obj)))
 8             continue;
 9@@ -2188,6 +2189,8 @@ xs_str *html_notifications(snac *user)
10         if (strcmp(type, "Undo") == 0 && strcmp(utype, "Follow") == 0)
11             label = L("Unfollow");
12 
13+        xs *s_date = xs_crop_i(xs_dup(date), 0, 10);
14+
15         xs_html *entry = xs_html_tag("div",
16             xs_html_attr("class", "snac-post-with-desc"),
17             xs_html_tag("p",
18@@ -2196,7 +2199,12 @@ xs_str *html_notifications(snac *user)
19                     xs_html_text(" by "),
20                     xs_html_tag("a",
21                         xs_html_attr("href", actor_id),
22-                        xs_html_raw(a_name))))); /* a_name is already sanitized */
23+                        xs_html_raw(a_name))), /* a_name is already sanitized */
24+                xs_html_text(" "),
25+                xs_html_tag("time",
26+                    xs_html_attr("class", "dt-published snac-pubdate"),
27+                    xs_html_attr("title", date),
28+                    xs_html_text(s_date))));
29 
30         if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) {
31             xs_html_add(entry,