Skip to content

Commit

Permalink
Challenge: Fixed self duel response
Browse files Browse the repository at this point in the history
  • Loading branch information
okbrandon committed Nov 14, 2024
1 parent 9908f2d commit af8719a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/api/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ def post(self, request, identifier, *args, **kwargs):
if invitee.userID == inviter.userID:
return Response({"error": "You cannot challenge yourself"},
status=status.HTTP_400_BAD_REQUEST)
if invitee.userID == "user_ai":
return Response({"error": "Challenge Prune via the matchmaking system"},
status=status.HTTP_400_BAD_REQUEST)

blocked = Relationship.objects.filter(
models.Q(userA=invitee.userID, userB=inviter.userID, status=2) |
Expand Down Expand Up @@ -659,6 +662,9 @@ def post(self, request, identifier, inviteID, action):
if not inviter:
return Response({"error": "User does not exist"},
status=status.HTTP_404_NOT_FOUND)
if inviter.userID == invitee.userID:
return Response({"error": "Abnormal behavior detected"},
status=status.HTTP_400_BAD_REQUEST)

invite = ChallengeInvite.objects.filter(
inviteID=inviteID,
Expand Down

0 comments on commit af8719a

Please sign in to comment.