Generate Reject activities.

Work on checking incoming / outgoing will work alone.
This commit is contained in:
Adam Kelly
2020-03-13 17:04:39 +00:00
parent fa57d6cfc7
commit 20662a90dd
5 changed files with 66 additions and 35 deletions

View File

@ -99,20 +99,23 @@ def handle_outgoing_unfollow(user, to_unfollow):
raise(error['error'])
def handle_outgoing_accept(user, to_follow, request_activity):
def handle_outgoing_accept(user, to_follow, follow_request):
''' send an acceptance message to a follow request '''
with transaction.atomic():
follow_request = models.UserFollowRequest.objects.get(
relationship_id=request_activity['id']
)
relationship = models.UserFollows.from_request(follow_request)
follow_request.delete()
relationship.save()
activity = activitypub.get_accept(to_follow, request_activity)
activity = activitypub.get_accept(to_follow, follow_request)
recipient = get_recipients(to_follow, 'direct', direct_recipients=[user])
broadcast(to_follow, activity, recipient)
def handle_outgoing_reject(user, to_follow, relationship):
relationship.delete()
activity = activitypub.get_reject(to_follow, relationship)
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 '''