mirror of https://github.com/zulip/zulip.git
confirmation: Set confirmation object realm attribute in realm reactivation.
The value of realm attribute in confirmation object used to be empty before. We are not currently using the realm attribute of reactivation links anywhere. The value of realm stored in content_object is currently used.
This commit is contained in:
parent
139ebf387b
commit
23036a9f40
|
@ -72,6 +72,9 @@ def create_confirmation_link(obj: ContentType, host: str,
|
|||
realm = None
|
||||
if hasattr(obj, 'realm'):
|
||||
realm = obj.realm
|
||||
elif isinstance(obj, Realm):
|
||||
realm = obj
|
||||
|
||||
Confirmation.objects.create(content_object=obj, date_sent=timezone_now(), confirmation_key=key,
|
||||
realm=realm, type=confirmation_type)
|
||||
return confirmation_url(key, host, confirmation_type, url_args)
|
||||
|
|
|
@ -223,6 +223,15 @@ class RealmTest(ZulipTestCase):
|
|||
realm = get_realm('zulip')
|
||||
self.assertFalse(realm.deactivated)
|
||||
|
||||
def test_realm_reactivation_confirmation_object(self) -> None:
|
||||
realm = get_realm('zulip')
|
||||
do_deactivate_realm(realm)
|
||||
self.assertTrue(realm.deactivated)
|
||||
create_confirmation_link(realm, realm.host, Confirmation.REALM_REACTIVATION)
|
||||
confirmation = Confirmation.objects.last()
|
||||
self.assertEqual(confirmation.content_object, realm)
|
||||
self.assertEqual(confirmation.realm, realm)
|
||||
|
||||
def test_do_send_realm_reactivation_email(self) -> None:
|
||||
realm = get_realm('zulip')
|
||||
do_send_realm_reactivation_email(realm)
|
||||
|
|
Loading…
Reference in New Issue