mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
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':
|
elif activity['type'] == 'Add':
|
||||||
response = handle_incoming_add(activity)
|
response = handle_incoming_add(activity)
|
||||||
|
|
||||||
elif activity['type'] == 'Reject':
|
elif activity['type'] == 'Reject':
|
||||||
response = handle_incoming_follow_reject(activity)
|
response = handle_incoming_follow_reject(activity)
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ def handle_incoming_follow(activity):
|
||||||
'FOLLOW',
|
'FOLLOW',
|
||||||
related_user=user
|
related_user=user
|
||||||
)
|
)
|
||||||
outgoing.handle_outgoing_accept(user, to_follow, request)
|
outgoing.handle_accept(user, to_follow, request)
|
||||||
else:
|
else:
|
||||||
status_builder.create_notification(
|
status_builder.create_notification(
|
||||||
to_follow,
|
to_follow,
|
||||||
|
|
|
@ -78,7 +78,7 @@ def handle_account_search(query):
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
def handle_outgoing_follow(user, to_follow):
|
def handle_follow(user, to_follow):
|
||||||
''' someone local wants to follow someone '''
|
''' someone local wants to follow someone '''
|
||||||
activity = activitypub.get_follow_request(user, to_follow)
|
activity = activitypub.get_follow_request(user, to_follow)
|
||||||
errors = broadcast(user, activity, [to_follow.inbox])
|
errors = broadcast(user, activity, [to_follow.inbox])
|
||||||
|
@ -86,7 +86,7 @@ def handle_outgoing_follow(user, to_follow):
|
||||||
raise(error['error'])
|
raise(error['error'])
|
||||||
|
|
||||||
|
|
||||||
def handle_outgoing_unfollow(user, to_unfollow):
|
def handle_unfollow(user, to_unfollow):
|
||||||
''' someone local wants to follow someone '''
|
''' someone local wants to follow someone '''
|
||||||
relationship = models.UserFollows.objects.get(
|
relationship = models.UserFollows.objects.get(
|
||||||
user_subject=user,
|
user_subject=user,
|
||||||
|
@ -99,7 +99,7 @@ def handle_outgoing_unfollow(user, to_unfollow):
|
||||||
raise(error['error'])
|
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 '''
|
''' send an acceptance message to a follow request '''
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
relationship = models.UserFollows.from_request(follow_request)
|
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])
|
recipient = get_recipients(to_follow, 'direct', direct_recipients=[user])
|
||||||
broadcast(to_follow, activity, recipient)
|
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 '''
|
''' a local user who managed follows rejects a follow request '''
|
||||||
relationship.delete()
|
relationship.delete()
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ def handle_reply(user, review, content):
|
||||||
broadcast(user, create_activity, recipients)
|
broadcast(user, create_activity, recipients)
|
||||||
|
|
||||||
|
|
||||||
def handle_outgoing_favorite(user, status):
|
def handle_favorite(user, status):
|
||||||
''' a user likes a status '''
|
''' a user likes a status '''
|
||||||
try:
|
try:
|
||||||
favorite = models.Favorite.objects.create(
|
favorite = models.Favorite.objects.create(
|
||||||
|
@ -275,7 +275,7 @@ def handle_outgoing_favorite(user, status):
|
||||||
broadcast(user, fav_activity, recipients)
|
broadcast(user, fav_activity, recipients)
|
||||||
|
|
||||||
|
|
||||||
def handle_outgoing_unfavorite(user, status):
|
def handle_unfavorite(user, status):
|
||||||
''' a user likes a status '''
|
''' a user likes a status '''
|
||||||
try:
|
try:
|
||||||
favorite = models.Favorite.objects.get(
|
favorite = models.Favorite.objects.get(
|
||||||
|
|
|
@ -229,7 +229,7 @@ def reply(request):
|
||||||
def favorite(request, status_id):
|
def favorite(request, status_id):
|
||||||
''' like a status '''
|
''' like a status '''
|
||||||
status = models.Status.objects.get(id=status_id)
|
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', '/'))
|
return redirect(request.headers.get('Referer', '/'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ def favorite(request, status_id):
|
||||||
def unfavorite(request, status_id):
|
def unfavorite(request, status_id):
|
||||||
''' like a status '''
|
''' like a status '''
|
||||||
status = models.Status.objects.get(id=status_id)
|
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', '/'))
|
return redirect(request.headers.get('Referer', '/'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ def follow(request):
|
||||||
except models.User.DoesNotExist:
|
except models.User.DoesNotExist:
|
||||||
return HttpResponseBadRequest()
|
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 \
|
user_slug = to_follow.localname if to_follow.localname \
|
||||||
else to_follow.username
|
else to_follow.username
|
||||||
return redirect('/user/%s' % user_slug)
|
return redirect('/user/%s' % user_slug)
|
||||||
|
@ -265,7 +265,7 @@ def unfollow(request):
|
||||||
except models.User.DoesNotExist:
|
except models.User.DoesNotExist:
|
||||||
return HttpResponseBadRequest()
|
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 \
|
user_slug = to_unfollow.localname if to_unfollow.localname \
|
||||||
else to_unfollow.username
|
else to_unfollow.username
|
||||||
return redirect('/user/%s' % user_slug)
|
return redirect('/user/%s' % user_slug)
|
||||||
|
@ -312,7 +312,7 @@ def accept_follow_request(request):
|
||||||
# Request already dealt with.
|
# Request already dealt with.
|
||||||
pass
|
pass
|
||||||
else:
|
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)
|
return redirect('/user/%s' % request.user.localname)
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ def delete_follow_request(request):
|
||||||
except models.UserFollowRequest.DoesNotExist:
|
except models.UserFollowRequest.DoesNotExist:
|
||||||
return HttpResponseBadRequest()
|
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)
|
return redirect('/user/%s' % request.user.localname)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue