Add tweak for forwarded activities from Hubzilla

This commit is contained in:
Thomas Sileo 2019-08-19 23:31:57 +02:00
parent 4f0812988b
commit e31ae7997d

View file

@ -40,6 +40,7 @@ from core.meta import by_type
from core.meta import flag from core.meta import flag
from core.meta import inc from core.meta import inc
from core.meta import upsert from core.meta import upsert
from core.remote import server
from core.tasks import Tasks from core.tasks import Tasks
from utils import now from utils import now
@ -178,6 +179,13 @@ def post_to_inbox(activity: ap.BaseActivity) -> None:
Tasks.process_reply(activity.get_object_id()) Tasks.process_reply(activity.get_object_id())
return 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}): if DB.activities.find_one({"box": Box.INBOX.value, "remote_id": activity.id}):
# The activity is already in the inbox # The activity is already in the inbox
logger.info(f"received duplicate activity {activity!r}, dropping it") logger.info(f"received duplicate activity {activity!r}, dropping it")