Fixes accept activity json

This commit is contained in:
Mouse Reeve 2020-02-17 20:52:14 -08:00
parent e7dc4af907
commit 78131805b7
2 changed files with 7 additions and 6 deletions

View file

@ -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 { return {
'@context': 'https://www.w3.org/ns/activitystreams', '@context': 'https://www.w3.org/ns/activitystreams',
'id': '%s#accepts/follows/' % to_follow.absolute_id, 'id': '%s#accepts/follows/' % user.absolute_id,
'type': 'Accept', 'type': 'Accept',
'actor': to_follow.actor, 'actor': user.actor,
'object': activity, 'object': request_activity,
} }

View file

@ -77,10 +77,10 @@ def handle_outgoing_follow(user, to_follow):
raise(error['error']) 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 ''' ''' send an acceptance message to a follow request '''
to_follow.followers.add(user) 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]) recipient = get_recipients(to_follow, 'direct', direct_recipients=[user])
broadcast(to_follow, activity, recipient) broadcast(to_follow, activity, recipient)