commit 52f2712

default  ·  2023-12-18 10:37:02 +0000 UTC
parent 45c5c71
Fixed follow / unfollow mess for shared inboxes.
1 files changed,  +8, -2
+8, -2
 1@@ -468,9 +468,9 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
 2         return following_check(snac, actor);
 3     }
 4 
 5-    /* if it's an Undo + Follow, it must be from someone we follow */
 6+    /* if it's an Undo + Follow, it must be from someone that follows us */
 7     if (xs_match(type, "Undo")) {
 8-        return following_check(snac, actor);
 9+        return follower_check(snac, actor);
10     }
11 
12     /* if it's an Accept + Follow, it must be for a Follow we created */
13@@ -478,6 +478,12 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
14         return following_check(snac, actor);
15     }
16 
17+    /* if it's a Follow, it must be explicitly for us */
18+    if (xs_match(type, "Follow")) {
19+        char *object = xs_dict_get(c_msg, "object");
20+        return !xs_is_null(object) && strcmp(snac->actor, object) == 0;
21+    }
22+
23     /* if it's not a Create or Update, allow as is */
24     if (!xs_match(type, "Create|Update")) {
25         return 1;