From 78131805b7b4b5998bbeba24b7a22d6988146bdf Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 17 Feb 2020 20:52:14 -0800 Subject: [PATCH] Fixes accept activity json --- fedireads/activitypub/follow.py | 9 +++++---- fedireads/outgoing.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fedireads/activitypub/follow.py b/fedireads/activitypub/follow.py index 8127b0599..599c2ff33 100644 --- a/fedireads/activitypub/follow.py +++ b/fedireads/activitypub/follow.py @@ -17,12 +17,13 @@ def get_follow_request(user, to_follow): } -def get_accept(user, to_follow, request_activity): +def get_accept(user, request_activity): + ''' accept a follow request ''' return { '@context': 'https://www.w3.org/ns/activitystreams', - 'id': '%s#accepts/follows/' % to_follow.absolute_id, + 'id': '%s#accepts/follows/' % user.absolute_id, 'type': 'Accept', - 'actor': to_follow.actor, - 'object': activity, + 'actor': user.actor, + 'object': request_activity, } diff --git a/fedireads/outgoing.py b/fedireads/outgoing.py index 56c1b99f6..53baa592f 100644 --- a/fedireads/outgoing.py +++ b/fedireads/outgoing.py @@ -77,10 +77,10 @@ def handle_outgoing_follow(user, to_follow): raise(error['error']) -def handle_outgoing_accept(user, to_follow, activity): +def handle_outgoing_accept(user, to_follow, request_activity): ''' send an acceptance message to a follow request ''' to_follow.followers.add(user) - activity = activitypub.get_accept(user, to_follow, activity) + activity = activitypub.get_accept(to_follow, request_activity) recipient = get_recipients(to_follow, 'direct', direct_recipients=[user]) broadcast(to_follow, activity, recipient)