From e31ae7997d1f0d237f05d775477535c1be0d6ef8 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 19 Aug 2019 23:31:57 +0200 Subject: [PATCH] Add tweak for forwarded activities from Hubzilla --- core/activitypub.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/activitypub.py b/core/activitypub.py index 2d413d1..a075136 100644 --- a/core/activitypub.py +++ b/core/activitypub.py @@ -40,6 +40,7 @@ from core.meta import by_type from core.meta import flag from core.meta import inc from core.meta import upsert +from core.remote import server from core.tasks import Tasks from utils import now @@ -178,6 +179,13 @@ def post_to_inbox(activity: ap.BaseActivity) -> None: Tasks.process_reply(activity.get_object_id()) return + # Hubzilla forward activities in a Create, process them as possible replies + if activity.has_type(ap.ActivityType.CREATE) and server(activity.id) != server( + activity.get_object_id() + ): + Tasks.process_reply(activity.get_object_id()) + return + if DB.activities.find_one({"box": Box.INBOX.value, "remote_id": activity.id}): # The activity is already in the inbox logger.info(f"received duplicate activity {activity!r}, dropping it")