Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions contentcuration/contentcuration/viewsets/user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uuid
from functools import reduce

from django.db import IntegrityError
Expand Down Expand Up @@ -311,11 +312,17 @@ def remove_self(self, request, pk=None):

if not channel_id:
return HttpResponseBadRequest("Channel ID is required.")
try:
uuid.UUID(channel_id)
except ValueError:
return HttpResponseBadRequest("Invalid channel ID")

try:
channel = Channel.objects.get(id=channel_id)
except Channel.DoesNotExist:
return HttpResponseNotFound("Channel not found {}".format(channel_id))
except ValueError:
return HttpResponseBadRequest("Invalid channel ID: {}".format(channel_id))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this now? Or is it dead code?


if request.user != user and not request.user.can_edit(channel_id):
return HttpResponseForbidden(
Expand Down
Loading