forked from GithubBackups/healthchecks
remove channel doesn't crash
This commit is contained in:
parent
96b41ded9b
commit
01a9505cc7
@ -45,4 +45,4 @@ class RemoveChannelTestCase(BaseTestCase):
|
||||
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.post(url)
|
||||
assert r.status_code == 404
|
||||
assert r.status_code == 302
|
||||
|
@ -336,11 +336,11 @@ def verify_email(request, code, token):
|
||||
def remove_channel(request, code):
|
||||
assert request.method == "POST"
|
||||
|
||||
channel = get_object_or_404(Channel, code=code)
|
||||
if channel.user != request.user:
|
||||
return HttpResponseForbidden()
|
||||
|
||||
channel.delete()
|
||||
channel = Channel.objects.filter(code=code).first()
|
||||
if channel:
|
||||
if channel.user != request.user:
|
||||
return HttpResponseForbidden()
|
||||
channel.delete()
|
||||
|
||||
return redirect("hc-channels")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user