forked from mirrors/bookwyrm
Rename handle_outgoing_whatever to handle_whatever
it's in a file called outgoing.py! you can already tell it's outoging
This commit is contained in:
parent
cf06b40c08
commit
952250009b
3 changed files with 14 additions and 13 deletions
|
@ -58,6 +58,7 @@ def shared_inbox(request):
|
|||
|
||||
elif activity['type'] == 'Add':
|
||||
response = handle_incoming_add(activity)
|
||||
|
||||
elif activity['type'] == 'Reject':
|
||||
response = handle_incoming_follow_reject(activity)
|
||||
|
||||
|
@ -152,7 +153,7 @@ def handle_incoming_follow(activity):
|
|||
'FOLLOW',
|
||||
related_user=user
|
||||
)
|
||||
outgoing.handle_outgoing_accept(user, to_follow, request)
|
||||
outgoing.handle_accept(user, to_follow, request)
|
||||
else:
|
||||
status_builder.create_notification(
|
||||
to_follow,
|
||||
|
|
|
@ -78,7 +78,7 @@ def handle_account_search(query):
|
|||
return user
|
||||
|
||||
|
||||
def handle_outgoing_follow(user, to_follow):
|
||||
def handle_follow(user, to_follow):
|
||||
''' someone local wants to follow someone '''
|
||||
activity = activitypub.get_follow_request(user, to_follow)
|
||||
errors = broadcast(user, activity, [to_follow.inbox])
|
||||
|
@ -86,7 +86,7 @@ def handle_outgoing_follow(user, to_follow):
|
|||
raise(error['error'])
|
||||
|
||||
|
||||
def handle_outgoing_unfollow(user, to_unfollow):
|
||||
def handle_unfollow(user, to_unfollow):
|
||||
''' someone local wants to follow someone '''
|
||||
relationship = models.UserFollows.objects.get(
|
||||
user_subject=user,
|
||||
|
@ -99,7 +99,7 @@ def handle_outgoing_unfollow(user, to_unfollow):
|
|||
raise(error['error'])
|
||||
|
||||
|
||||
def handle_outgoing_accept(user, to_follow, follow_request):
|
||||
def handle_accept(user, to_follow, follow_request):
|
||||
''' send an acceptance message to a follow request '''
|
||||
with transaction.atomic():
|
||||
relationship = models.UserFollows.from_request(follow_request)
|
||||
|
@ -110,7 +110,7 @@ def handle_outgoing_accept(user, 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):
|
||||
def handle_reject(user, to_follow, relationship):
|
||||
''' a local user who managed follows rejects a follow request '''
|
||||
relationship.delete()
|
||||
|
||||
|
@ -259,7 +259,7 @@ def handle_reply(user, review, content):
|
|||
broadcast(user, create_activity, recipients)
|
||||
|
||||
|
||||
def handle_outgoing_favorite(user, status):
|
||||
def handle_favorite(user, status):
|
||||
''' a user likes a status '''
|
||||
try:
|
||||
favorite = models.Favorite.objects.create(
|
||||
|
@ -275,7 +275,7 @@ def handle_outgoing_favorite(user, status):
|
|||
broadcast(user, fav_activity, recipients)
|
||||
|
||||
|
||||
def handle_outgoing_unfavorite(user, status):
|
||||
def handle_unfavorite(user, status):
|
||||
''' a user likes a status '''
|
||||
try:
|
||||
favorite = models.Favorite.objects.get(
|
||||
|
|
|
@ -229,7 +229,7 @@ def reply(request):
|
|||
def favorite(request, status_id):
|
||||
''' like a status '''
|
||||
status = models.Status.objects.get(id=status_id)
|
||||
outgoing.handle_outgoing_favorite(request.user, status)
|
||||
outgoing.handle_favorite(request.user, status)
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ def favorite(request, status_id):
|
|||
def unfavorite(request, status_id):
|
||||
''' like a status '''
|
||||
status = models.Status.objects.get(id=status_id)
|
||||
outgoing.handle_outgoing_unfavorite(request.user, status)
|
||||
outgoing.handle_unfavorite(request.user, status)
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
|
@ -250,7 +250,7 @@ def follow(request):
|
|||
except models.User.DoesNotExist:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
outgoing.handle_outgoing_follow(request.user, to_follow)
|
||||
outgoing.handle_follow(request.user, to_follow)
|
||||
user_slug = to_follow.localname if to_follow.localname \
|
||||
else to_follow.username
|
||||
return redirect('/user/%s' % user_slug)
|
||||
|
@ -265,7 +265,7 @@ def unfollow(request):
|
|||
except models.User.DoesNotExist:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
outgoing.handle_outgoing_unfollow(request.user, to_unfollow)
|
||||
outgoing.handle_unfollow(request.user, to_unfollow)
|
||||
user_slug = to_unfollow.localname if to_unfollow.localname \
|
||||
else to_unfollow.username
|
||||
return redirect('/user/%s' % user_slug)
|
||||
|
@ -312,7 +312,7 @@ def accept_follow_request(request):
|
|||
# Request already dealt with.
|
||||
pass
|
||||
else:
|
||||
outgoing.handle_outgoing_accept(requester, request.user, follow_request)
|
||||
outgoing.handle_accept(requester, request.user, follow_request)
|
||||
|
||||
return redirect('/user/%s' % request.user.localname)
|
||||
|
||||
|
@ -334,7 +334,7 @@ def delete_follow_request(request):
|
|||
except models.UserFollowRequest.DoesNotExist:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
outgoing.handle_outgoing_reject(requester, request.user, follow_request)
|
||||
outgoing.handle_reject(requester, request.user, follow_request)
|
||||
return redirect('/user/%s' % request.user.localname)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue