diff --git a/templates/zerver/deactivated.html b/templates/zerver/deactivated.html index 3dc3989408..484ef71f91 100644 --- a/templates/zerver/deactivated.html +++ b/templates/zerver/deactivated.html @@ -19,6 +19,13 @@
{% trans %} The organization you are trying to join, {{ deactivated_domain_name }}, has been deactivated. + {% endtrans %} + {% if deactivated_redirect %} + {% trans %} + It has moved to {{ deactivated_redirect }}. + {% endtrans %} + {% endif %} + {% trans %} Please contact {{ support_email }} to reactivate this group. {% endtrans %} diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index 9551e15ad0..73cb2b35d8 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -171,6 +171,16 @@ class DeactivationNoticeTestCase(ZulipTestCase): result = self.client_get('/accounts/deactivated/') self.assertIn("Zulip Dev, has been deactivated.", result.content.decode()) + self.assertNotIn("It has moved to", result.content.decode()) + + def test_deactivation_notice_when_deactivated_and_deactivated_redirect_is_set(self) -> None: + realm = get_realm("zulip") + realm.deactivated = True + realm.deactivated_redirect = "http://example.zulipchat.com" + realm.save(update_fields=["deactivated", "deactivated_redirect"]) + + result = self.client_get('/accounts/deactivated/') + self.assertIn('It has moved to http://example.zulipchat.com.', result.content.decode()) class AddNewUserHistoryTest(ZulipTestCase): def test_add_new_user_history_race(self) -> None: diff --git a/zerver/views/auth.py b/zerver/views/auth.py index a513cf7118..04f30efce3 100644 --- a/zerver/views/auth.py +++ b/zerver/views/auth.py @@ -601,8 +601,11 @@ def redirect_to_misconfigured_ldap_notice(request: HttpResponse, error_type: int def show_deactivation_notice(request: HttpRequest) -> HttpResponse: realm = get_realm_from_request(request) if realm and realm.deactivated: + context = {"deactivated_domain_name": realm.name} + if realm.deactivated_redirect is not None: + context["deactivated_redirect"] = realm.deactivated_redirect return render(request, "zerver/deactivated.html", - context={"deactivated_domain_name": realm.name}) + context=context) return HttpResponseRedirect(reverse('login_page'))