From 3bf1ad9746f1d28b75f009970ced1654a41fe418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 13 Apr 2020 12:26:05 +0300 Subject: [PATCH] Fix invite suggestions. --- hc/accounts/tests/test_project.py | 9 +++++++++ templates/accounts/project.html | 8 +++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hc/accounts/tests/test_project.py b/hc/accounts/tests/test_project.py index 55bfde9c..79ad0b5b 100644 --- a/hc/accounts/tests/test_project.py +++ b/hc/accounts/tests/test_project.py @@ -172,3 +172,12 @@ class ProjectTestCase(BaseTestCase): self.project.refresh_from_db() self.assertEqual(self.project.name, "Alpha Team") + + def test_it_shows_invite_suggestions(self): + p2 = Project.objects.create(owner=self.alice) + + self.client.login(username="alice@example.org", password="password") + + r = self.client.get("/projects/%s/settings/" % p2.code) + self.assertContains(r, "Add Users from Other Teams") + self.assertContains(r, "bob@example.org") diff --git a/templates/accounts/project.html b/templates/accounts/project.html index cd6010e4..835da63a 100644 --- a/templates/accounts/project.html +++ b/templates/accounts/project.html @@ -135,6 +135,7 @@ {% endif %} + {% with invite_suggestions=project.invite_suggestions %}

Team Access

@@ -165,9 +166,7 @@ {% endfor %} - {% if is_owner %} - {% with invite_suggestions=project.invite_suggestions %} - {% if invite_suggestions %} + {% if is_owner and invite_suggestions %} Add Users from Other Teams @@ -187,8 +186,6 @@ {% endfor %} {% endif %} - {% endwith %} - {% endif %} {% else %}

@@ -216,6 +213,7 @@ {% endif %} {% endif %}

+ {% endwith %} {% if team_member_invited %}