Skip to content

Commit

Permalink
Add responses
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewLester committed Apr 28, 2022
1 parent 4b427aa commit 6f8a3a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zubhub_backend/zubhub/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,15 @@ class ProjectViolationsClearApiView(APIView):
permission_classes = [IsAuthenticated, IsOwner]
throttle_classes = [CustomUserRateThrottle, SustainedRateThrottle]

def post(self, _, *, pk):
def post(self, request, *, pk):
try:
old = Project.objects.get(pk=pk)
except Project.DoesNotExist:
return
return Response('Not found', status=404)

if not request.user or old.creator.id != request.user.id:
return Response('Error', status=403)

old.violations.set([])
old.save()
return Response('Success')
Expand Down

0 comments on commit 6f8a3a7

Please sign in to comment.