commit 0394f835e45975b9a82b0b009de2471e55a6cb7a
parent fda3057dc86d859a0935d2f5fce890d114db5861
Author: default <nobody@localhost>
Date: Thu, 23 Jan 2025 20:09:22 +0100
Added some code to supress repeated notifications.
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/html.c b/html.c
@@ -2967,9 +2967,12 @@ xs_str *html_notifications(snac *user, int skip, int show)
xs_html_attr("class", "snac-posts"));
xs_html_add(body, posts);
- xs_list *p = n_list;
+ xs_set rep;
+ xs_set_init(&rep);
+
const xs_str *v;
- while (xs_list_iter(&p, &v)) {
+
+ xs_list_foreach(n_list, v) {
xs *noti = notify_get(user, v);
if (noti == NULL)
@@ -2990,6 +2993,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
object_get(id, &obj);
+ if (xs_set_add(&rep, xs_dict_get(obj, "id")) != 1)
+ continue;
+
const char *actor_id = xs_dict_get(noti, "actor");
xs *actor = NULL;
@@ -3103,6 +3109,8 @@ xs_str *html_notifications(snac *user, int skip, int show)
}
}
+ xs_set_free(&rep);
+
if (noti_new == NULL && noti_seen == NULL)
xs_html_add(body,
xs_html_tag("h2",