Skip to content

Commit

Permalink
refactor if condition in friend_invite_status
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineverin committed Oct 2, 2024
1 parent 7b9876e commit ebebadd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django/src/friends/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def update_invite_status(request: HttpRequest, status: str):

try:
invite = Friend.objects.get(id=data['invite_id'], target=request.user)
if not invite.status == Friend.Status.PENDING:
if invite.status != Friend.Status.PENDING:
return JsonResponse({'error': f'Invite already {'denied' if invite.status is Friend.Status.DENIED else 'accepted'}'}, status=400)
invite.status = status
invite.save()
Expand Down

0 comments on commit ebebadd

Please sign in to comment.