commit 896a36837c8da070d85abe92d62d12c4009fca1c
parent 71537bdaf8fa3e752b7178efdf53e5c1c1402973
Author: default <nobody@localhost>
Date: Sat, 25 Jan 2025 21:45:14 +0100
Another tweak to fix repeated notifications.
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/html.c b/html.c
@@ -2967,6 +2967,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
xs_html_attr("class", "snac-posts"));
xs_html_add(body, posts);
+ xs_set rep;
+ xs_set_init(&rep);
+
/* dict to store previous notification labels */
xs *admiration_labels = xs_dict_new();
@@ -2983,6 +2986,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
const char *utype = xs_dict_get(noti, "utype");
const char *id = xs_dict_get(noti, "objid");
const char *date = xs_dict_get(noti, "date");
+ const char *id2 = xs_dict_get_path(noti, "msg.id");
xs *wrk = NULL;
if (xs_is_null(id))
@@ -2991,6 +2995,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
if (is_hidden(user, id))
continue;
+ if (xs_is_string(id2) && xs_set_add(&rep, id2) != 1)
+ continue;
+
object_get(id, &obj);
const char *msg_id = NULL;
@@ -3158,6 +3165,8 @@ xs_str *html_notifications(snac *user, int skip, int show)
xs_html_text(L("More...")))));
}
+ xs_set_free(&rep);
+
xs_html_add(body,
html_footer());