summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2025-01-23 20:09:22 +0100
committerGravatar default2025-01-23 20:09:22 +0100
commit0394f835e45975b9a82b0b009de2471e55a6cb7a (patch)
treed3a931146efbe338d156dabb2be2e469a7d106b0
parentMore hashtag following tweaks. (diff)
downloadpenes-snac2-0394f835e45975b9a82b0b009de2471e55a6cb7a.tar.gz
penes-snac2-0394f835e45975b9a82b0b009de2471e55a6cb7a.tar.xz
penes-snac2-0394f835e45975b9a82b0b009de2471e55a6cb7a.zip
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)
2967 xs_html_attr("class", "snac-posts")); 2967 xs_html_attr("class", "snac-posts"));
2968 xs_html_add(body, posts); 2968 xs_html_add(body, posts);
2969 2969
2970 xs_list *p = n_list; 2970 xs_set rep;
2971 xs_set_init(&rep);
2972
2971 const xs_str *v; 2973 const xs_str *v;
2972 while (xs_list_iter(&p, &v)) { 2974
2975 xs_list_foreach(n_list, v) {
2973 xs *noti = notify_get(user, v); 2976 xs *noti = notify_get(user, v);
2974 2977
2975 if (noti == NULL) 2978 if (noti == NULL)
@@ -2990,6 +2993,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
2990 2993
2991 object_get(id, &obj); 2994 object_get(id, &obj);
2992 2995
2996 if (xs_set_add(&rep, xs_dict_get(obj, "id")) != 1)
2997 continue;
2998
2993 const char *actor_id = xs_dict_get(noti, "actor"); 2999 const char *actor_id = xs_dict_get(noti, "actor");
2994 xs *actor = NULL; 3000 xs *actor = NULL;
2995 3001
@@ -3103,6 +3109,8 @@ xs_str *html_notifications(snac *user, int skip, int show)
3103 } 3109 }
3104 } 3110 }
3105 3111
3112 xs_set_free(&rep);
3113
3106 if (noti_new == NULL && noti_seen == NULL) 3114 if (noti_new == NULL && noti_seen == NULL)
3107 xs_html_add(body, 3115 xs_html_add(body,
3108 xs_html_tag("h2", 3116 xs_html_tag("h2",