commit 0394f83

default  ·  2025-01-23 19:09:22 +0000 UTC
parent fda3057
Added some code to supress repeated notifications.
1 files changed,  +10, -2
M html.c
M html.c
+10, -2
 1@@ -2967,9 +2967,12 @@ xs_str *html_notifications(snac *user, int skip, int show)
 2         xs_html_attr("class", "snac-posts"));
 3     xs_html_add(body, posts);
 4 
 5-    xs_list *p = n_list;
 6+    xs_set rep;
 7+    xs_set_init(&rep);
 8+
 9     const xs_str *v;
10-    while (xs_list_iter(&p, &v)) {
11+
12+    xs_list_foreach(n_list, v) {
13         xs *noti = notify_get(user, v);
14 
15         if (noti == NULL)
16@@ -2990,6 +2993,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
17 
18         object_get(id, &obj);
19 
20+        if (xs_set_add(&rep, xs_dict_get(obj, "id")) != 1)
21+            continue;
22+
23         const char *actor_id = xs_dict_get(noti, "actor");
24         xs *actor = NULL;
25 
26@@ -3103,6 +3109,8 @@ xs_str *html_notifications(snac *user, int skip, int show)
27         }
28     }
29 
30+    xs_set_free(&rep);
31+
32     if (noti_new == NULL && noti_seen == NULL)
33         xs_html_add(body,
34             xs_html_tag("h2",