diff options
| author | default <nobody@localhost> | 2025-01-23 20:09:22 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-01-23 20:09:22 +0100 |
| commit | 0394f835e45975b9a82b0b009de2471e55a6cb7a (patch) | |
| tree | d3a931146efbe338d156dabb2be2e469a7d106b0 /html.c | |
| parent | fda3057dc86d859a0935d2f5fce890d114db5861 (diff) | |
Added some code to supress repeated notifications.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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", |