Browse Source

Fix the "Integrations" page for when the user has no active project

pull/230/head
Pēteris Caune 6 years ago
parent
commit
d5bae3d3d8
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 14 additions and 0 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +8
    -0
      hc/front/tests/test_channels.py
  3. +5
    -0
      hc/front/views.py

+ 1
- 0
CHANGELOG.md View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
### Bug Fixes ### Bug Fixes
- Fix badges for tags containing special characters (#240, #237) - Fix badges for tags containing special characters (#240, #237)
- Fix the "Integrations" page for when the user has no active project
## 1.7.0 - 2019-05-02 ## 1.7.0 - 2019-05-02


+ 8
- 0
hc/front/tests/test_channels.py View File

@ -106,3 +106,11 @@ class ChannelsTestCase(BaseTestCase):
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
self.assertContains(r, "SMS to +123") self.assertContains(r, "SMS to +123")
def test_it_requires_current_project(self):
self.profile.current_project = None
self.profile.save()
self.client.login(username="[email protected]", password="password")
r = self.client.get("/integrations/")
self.assertRedirects(r, "/")

+ 5
- 0
hc/front/views.py View File

@ -560,6 +560,11 @@ def badges(request, code):
@login_required @login_required
def channels(request): def channels(request):
if not request.project:
# This can happen when the user deletes their only project.
return redirect("hc-index")
if request.method == "POST": if request.method == "POST":
code = request.POST["channel"] code = request.POST["channel"]
try: try:


Loading…
Cancel
Save