mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
Add RealmAlias.allow_subdomains to model, frontend, and API.
Includes a database migration. Fixes #1868.
This commit is contained in:
committed by
Tim Abbott
parent
a16c48f0c4
commit
7d10cbc32b
@@ -3616,17 +3616,27 @@ def get_emails_from_user_ids(user_ids):
|
||||
|
||||
def get_realm_aliases(realm):
|
||||
# type: (Realm) -> List[Dict[str, Text]]
|
||||
return list(realm.realmalias_set.values('domain'))
|
||||
return list(realm.realmalias_set.values('domain', 'allow_subdomains'))
|
||||
|
||||
def do_add_realm_alias(realm, domain):
|
||||
# type: (Realm, Text) -> (RealmAlias)
|
||||
alias = RealmAlias.objects.create(realm=realm, domain=domain)
|
||||
def do_add_realm_alias(realm, domain, allow_subdomains):
|
||||
# type: (Realm, Text, bool) -> (RealmAlias)
|
||||
alias = RealmAlias.objects.create(realm=realm, domain=domain,
|
||||
allow_subdomains=allow_subdomains)
|
||||
event = dict(type="realm_domains", op="add",
|
||||
alias=dict(domain=alias.domain,
|
||||
))
|
||||
allow_subdomains=alias.allow_subdomains))
|
||||
send_event(event, active_user_ids(realm))
|
||||
return alias
|
||||
|
||||
def do_change_realm_alias(alias, allow_subdomains):
|
||||
# type: (RealmAlias, bool) -> None
|
||||
alias.allow_subdomains = allow_subdomains
|
||||
alias.save(update_fields=['allow_subdomains'])
|
||||
event = dict(type="realm_domains", op="change",
|
||||
alias=dict(domain=alias.domain,
|
||||
allow_subdomains=alias.allow_subdomains))
|
||||
send_event(event, active_user_ids(alias.realm))
|
||||
|
||||
def do_remove_realm_alias(alias):
|
||||
# type: (RealmAlias) -> None
|
||||
realm = alias.realm
|
||||
|
||||
Reference in New Issue
Block a user