From 9012356a19f0b4133a6b15e2df4d46a3ad3f5717 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 4 Jul 2022 22:16:07 +0200 Subject: [PATCH] Fix issue with actors without followers/following collection --- app/activitypub.py | 2 +- app/actor.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/activitypub.py b/app/activitypub.py index ea8141e..8bebc26 100644 --- a/app/activitypub.py +++ b/app/activitypub.py @@ -209,7 +209,7 @@ def object_visibility(ap_activity: RawObject, actor: "Actor") -> VisibilityEnum: return VisibilityEnum.PUBLIC elif AS_PUBLIC in cc: return VisibilityEnum.UNLISTED - elif actor.followers_collection_id in to + cc: + elif actor.followers_collection_id and actor.followers_collection_id in to + cc: return VisibilityEnum.FOLLOWERS_ONLY else: return VisibilityEnum.DIRECT diff --git a/app/actor.py b/app/actor.py index 230bf1c..ca56f98 100644 --- a/app/actor.py +++ b/app/actor.py @@ -103,8 +103,8 @@ class Actor: return self.ap_actor.get("tag", []) @property - def followers_collection_id(self) -> str: - return self.ap_actor["followers"] + def followers_collection_id(self) -> str | None: + return self.ap_actor.get("followers") class RemoteActor(Actor):