Browse Source

Another tweak to fix repeated notifications.

default 2 months ago
parent
commit
896a36837c
1 changed files with 9 additions and 0 deletions
  1. 9 0
      html.c

+ 9 - 0
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());