aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-23 20:09:22 +0100
committerdefault <nobody@localhost>2025-01-23 20:09:22 +0100
commit0394f835e45975b9a82b0b009de2471e55a6cb7a (patch)
treed3a931146efbe338d156dabb2be2e469a7d106b0
parentfda3057dc86d859a0935d2f5fce890d114db5861 (diff)
Added some code to supress repeated notifications.
-rw-r--r--html.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/html.c b/html.c
index a15bd06..d325063 100644
--- 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",