Răsfoiți Sursa

Show notifications from cool users.

grunfink 1 săptămână în urmă
părinte
comite
f80614bb0f
2 a modificat fișierele cu 20 adăugiri și 3 ștergeri
  1. 1 1
      activitypub.c
  2. 19 2
      html.c

+ 1 - 1
activitypub.c

@@ -1227,7 +1227,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
         /* only notify of notes specifically for us */
         xs *rcpts = recipient_list(snac, msg, 0);
 
-        if (xs_list_in(rcpts, snac->actor) == -1)
+        if (xs_list_in(rcpts, snac->actor) == -1 && !cool(snac, actor, OP_CHECK))
             return;
 
         /* discard votes */

+ 19 - 2
html.c

@@ -4476,8 +4476,25 @@ xs_str *html_notifications(snac *user, int skip, int show)
         xs *label_sanitized = sanitize(type);
         const char *label = label_sanitized;
 
-        if (strcmp(type, "Create") == 0)
-            label = L("Mention");
+        if (strcmp(type, "Create") == 0) {
+            label = L("Post");
+
+            /* check if it's a mention */
+            const xs_list *l = xs_dict_get_def(obj, "tag", xs_stock(XSTYPE_LIST));
+            const xs_dict *d;
+
+            xs_list_foreach(l, d) {
+                if (xs_is_dict(d)) {
+                    const char *type = xs_dict_get_def(d, "type", "");
+                    const char *href = xs_dict_get_def(d, "href", "");
+
+                    if (strcmp(type, "Mention") == 0 && strcmp(href, user->actor) == 0) {
+                        label = L("Mention");
+                        break;
+                    }
+                }
+            }
+        }
         else
         if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0)
             label = L("Finished poll");