commit 896a368

default  ·  2025-01-25 20:45:14 +0000 UTC
parent 71537bd
Another tweak to fix repeated notifications.
1 files changed,  +9, -0
M html.c
M html.c
+9, -0
 1@@ -2967,6 +2967,9 @@ 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_set rep;
 6+    xs_set_init(&rep);
 7+
 8     /* dict to store previous notification labels */
 9     xs *admiration_labels = xs_dict_new();
10 
11@@ -2983,6 +2986,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
12         const char *utype = xs_dict_get(noti, "utype");
13         const char *id    = xs_dict_get(noti, "objid");
14         const char *date  = xs_dict_get(noti, "date");
15+        const char *id2   = xs_dict_get_path(noti, "msg.id");
16         xs *wrk = NULL;
17 
18         if (xs_is_null(id))
19@@ -2991,6 +2995,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
20         if (is_hidden(user, id))
21             continue;
22 
23+        if (xs_is_string(id2) && xs_set_add(&rep, id2) != 1)
24+            continue;
25+
26         object_get(id, &obj);
27 
28         const char *msg_id = NULL;
29@@ -3158,6 +3165,8 @@ xs_str *html_notifications(snac *user, int skip, int show)
30                     xs_html_text(L("More...")))));
31     }
32 
33+    xs_set_free(&rep);
34+
35     xs_html_add(body,
36         html_footer());
37