remove unnecessary actor checking for (un)follows
authorIzalia Mae <izalia@barkshark.xyz>
Wed, 18 Mar 2020 04:53:21 +0000 (00:53 -0400)
committerIzalia Mae <izalia@barkshark.xyz>
Wed, 18 Mar 2020 04:53:21 +0000 (00:53 -0400)
relay/actor.py

index 4c61f75..6974ef5 100644 (file)
@@ -245,8 +245,7 @@ async def handle_follow(actor, data, request):
         following += [inbox]
         DATABASE['relay-list'] = following
 
-        if data['object'].endswith('/actor'):
-            asyncio.ensure_future(follow_remote_actor(actor['id']))
+        asyncio.ensure_future(follow_remote_actor(actor['id']))
 
     message = {
         "@context": "https://www.w3.org/ns/activitystreams",
@@ -256,10 +255,10 @@ async def handle_follow(actor, data, request):
 
         # this is wrong per litepub, but mastodon < 2.4 is not compliant with that profile.
         "object": {
-             "type": "Follow",
-             "id": data["id"],
-             "object": "https://{}/actor".format(request.host),
-             "actor": actor["id"]
+            "type": "Follow",
+            "id": data["id"],
+            "object": "https://{}/actor".format(request.host),
+            "actor": actor["id"]
         },
 
         "id": "https://{}/activities/{}".format(request.host, uuid.uuid4()),
@@ -281,8 +280,7 @@ async def handle_undo(actor, data, request):
             following.remove(inbox)
             DATABASE['relay-list'] = following
 
-        if child['object'].endswith('/actor'):
-            await unfollow_remote_actor(actor['id'])
+        await unfollow_remote_actor(actor['id'])
 
 
 processors = {