Fixes accept follow request

Fixes #3
This commit is contained in:
Mouse Reeve
2020-02-14 22:44:07 -08:00
parent c4549e9b17
commit e0e419a757
3 changed files with 25 additions and 17 deletions

View File

@ -108,6 +108,24 @@ def handle_outgoing_follow(user, to_follow):
raise(error['error'])
def handle_outgoing_accept(user, to_follow, activity):
''' send an acceptance message to a follow request '''
to_follow.followers.add(user)
activity = {
'@context': 'https://www.w3.org/ns/activitystreams',
'id': 'https://%s/%s#accepts/follows/' % (DOMAIN, to_follow.localname),
'type': 'Accept',
'actor': to_follow.actor,
'object': activity,
}
recipient = get_recipients(
to_follow,
'direct',
direct_recipients=[user]
)
broadcast(to_follow, activity, recipient)
def handle_shelve(user, book, shelf):
''' a local user is getting a book put on their shelf '''
# update the database