From 8f3208175cfb97d5347e09a326c41fcaa6cf37af Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 31 Jul 2018 22:42:50 +0200 Subject: [PATCH] Allow to reply to external activities --- app.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index c0fcd57..0899332 100644 --- a/app.py +++ b/app.py @@ -1356,12 +1356,20 @@ def admin_new(): reply_id = None content = "" thread = [] + print(request.args) if request.args.get("reply"): data = DB.activities.find_one({"activity.object.id": request.args.get("reply")}) - if not data: - abort(400) + if data: + reply = ap.parse_activity(data["activity"]) + else: + data = dict( + meta={}, + activity=dict( + object=get_backend().fetch_iri(request.args.get("reply")) + ), + ) + reply = ap.parse_activity(data["activity"]["object"]) - reply = ap.parse_activity(data["activity"]) reply_id = reply.id if reply.ACTIVITY_TYPE == ActivityType.CREATE: reply_id = reply.get_object().id