mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
change_subdomain: Create a deactivated realm on updating subdomain.
When changing the subdomain of a realm, create a deactivated realm with the old subdomain of the realm, and set its deactivated_redirect to the new subdomain. Doing this will help us to do the following: - When a user visits the old subdomain of a realm, we can tell the user that the realm has been moved. - During the registration process, we can assure that the old subdomain of the realm is not used to create a new realm. If the subdomain is changed multiple times, the deactivated_redirect fields of all the deactivated realms are updated to point to the new uri.
This commit is contained in:
committed by
Alex Vandiver
parent
42dfd98607
commit
6c888977a6
@@ -745,7 +745,8 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
realm_id = lear_realm.id
|
||||
lear_realm = get_realm('new-name')
|
||||
self.assertEqual(lear_realm.id, realm_id)
|
||||
self.assertFalse(Realm.objects.filter(string_id='lear').exists())
|
||||
self.assertTrue(Realm.objects.filter(string_id='lear').exists())
|
||||
self.assertTrue(Realm.objects.filter(string_id='lear')[0].deactivated)
|
||||
|
||||
result = self.client_post("/activity/support", {"realm_id": f"{lear_realm.id}", "new_subdomain": "new-name"})
|
||||
self.assert_in_success_response(["Subdomain unavailable. Please choose a different one."], result)
|
||||
@@ -753,6 +754,9 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
result = self.client_post("/activity/support", {"realm_id": f"{lear_realm.id}", "new_subdomain": "zulip"})
|
||||
self.assert_in_success_response(["Subdomain unavailable. Please choose a different one."], result)
|
||||
|
||||
result = self.client_post("/activity/support", {"realm_id": f"{lear_realm.id}", "new_subdomain": "lear"})
|
||||
self.assert_in_success_response(["Subdomain unavailable. Please choose a different one."], result)
|
||||
|
||||
def test_downgrade_realm(self) -> None:
|
||||
cordelia = self.example_user('cordelia')
|
||||
self.login_user(cordelia)
|
||||
|
Reference in New Issue
Block a user