Skip to content

Commit

Permalink
Merge pull request #208 from 2i2c-org/fix-anon
Browse files Browse the repository at this point in the history
Support showing details about a submission without being logged in
  • Loading branch information
yuvipanda authored Nov 26, 2024
2 parents c6cfbdb + 7bbfc1c commit 2a46b1c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frx_challenges/web/views/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ def detail_evaluation(request: HttpRequest, id: int) -> HttpResponse:
return render(request, "submission/evaluation.html", {"evaluation": evaluation})


def _validate_collaborator(request: HttpRequest, id: int):
def _validate_collaborator(request: HttpRequest, submission_id: int):
"""
Validate that the user is a collaborator of the submission.
Check if current user is a collaborator on this submission
"""
if request.user.is_anonymous:
return False
try:
Collaborator.objects.get(submission_id=id, user=request.user)
is_collaborator = True
Collaborator.objects.get(submission_id=submission_id, user=request.user)
return True
except Collaborator.DoesNotExist:
is_collaborator = False

return is_collaborator
return False

0 comments on commit 2a46b1c

Please sign in to comment.