mirror of https://github.com/zulip/zulip.git
create_user: Remove redundant argument of get_display_email_address.
This commit is contained in:
parent
c693ae8982
commit
b15dd9147d
|
@ -695,7 +695,7 @@ def do_set_realm_property(realm: Realm, name: str, value: Any,
|
||||||
|
|
||||||
user_profiles = UserProfile.objects.filter(realm=realm, is_bot=False)
|
user_profiles = UserProfile.objects.filter(realm=realm, is_bot=False)
|
||||||
for user_profile in user_profiles:
|
for user_profile in user_profiles:
|
||||||
user_profile.email = get_display_email_address(user_profile, realm)
|
user_profile.email = get_display_email_address(user_profile)
|
||||||
# TODO: Design a bulk event for this or force-reload all clients
|
# TODO: Design a bulk event for this or force-reload all clients
|
||||||
send_user_email_update_event(user_profile)
|
send_user_email_update_event(user_profile)
|
||||||
UserProfile.objects.bulk_update(user_profiles, ['email'])
|
UserProfile.objects.bulk_update(user_profiles, ['email'])
|
||||||
|
|
|
@ -41,7 +41,7 @@ def bulk_create_users(realm: Realm,
|
||||||
UserProfile.objects.bulk_create(profiles_to_create)
|
UserProfile.objects.bulk_create(profiles_to_create)
|
||||||
|
|
||||||
for user_profile in profiles_to_create:
|
for user_profile in profiles_to_create:
|
||||||
user_profile.email = get_display_email_address(user_profile, realm)
|
user_profile.email = get_display_email_address(user_profile)
|
||||||
UserProfile.objects.bulk_update(profiles_to_create, ['email'])
|
UserProfile.objects.bulk_update(profiles_to_create, ['email'])
|
||||||
|
|
||||||
user_ids = {user.id for user in profiles_to_create}
|
user_ids = {user.id for user in profiles_to_create}
|
||||||
|
|
|
@ -45,7 +45,7 @@ def copy_user_settings(source_profile: UserProfile, target_profile: UserProfile)
|
||||||
|
|
||||||
copy_hotpots(source_profile, target_profile)
|
copy_hotpots(source_profile, target_profile)
|
||||||
|
|
||||||
def get_display_email_address(user_profile: UserProfile, realm: Realm) -> str:
|
def get_display_email_address(user_profile: UserProfile) -> str:
|
||||||
if not user_profile.email_address_is_realm_public():
|
if not user_profile.email_address_is_realm_public():
|
||||||
return f"user{user_profile.id}@{get_fake_email_domain()}"
|
return f"user{user_profile.id}@{get_fake_email_domain()}"
|
||||||
return user_profile.delivery_email
|
return user_profile.delivery_email
|
||||||
|
@ -98,7 +98,7 @@ def create_user_profile(realm: Realm, email: str, password: Optional[str],
|
||||||
password = None
|
password = None
|
||||||
if user_profile.email_address_is_realm_public():
|
if user_profile.email_address_is_realm_public():
|
||||||
# If emails are visible to everyone, we can set this here and save a DB query
|
# If emails are visible to everyone, we can set this here and save a DB query
|
||||||
user_profile.email = get_display_email_address(user_profile, realm)
|
user_profile.email = get_display_email_address(user_profile)
|
||||||
user_profile.set_password(password)
|
user_profile.set_password(password)
|
||||||
user_profile.api_key = generate_api_key()
|
user_profile.api_key = generate_api_key()
|
||||||
return user_profile
|
return user_profile
|
||||||
|
@ -159,7 +159,7 @@ def create_user(email: str,
|
||||||
# With restricted access to email addresses, we can't generate
|
# With restricted access to email addresses, we can't generate
|
||||||
# the fake email addresses we use for display purposes without
|
# the fake email addresses we use for display purposes without
|
||||||
# a User ID, which isn't generated until the .save() above.
|
# a User ID, which isn't generated until the .save() above.
|
||||||
user_profile.email = get_display_email_address(user_profile, realm)
|
user_profile.email = get_display_email_address(user_profile)
|
||||||
user_profile.save(update_fields=['email'])
|
user_profile.save(update_fields=['email'])
|
||||||
|
|
||||||
recipient = Recipient.objects.create(type_id=user_profile.id,
|
recipient = Recipient.objects.create(type_id=user_profile.id,
|
||||||
|
|
Loading…
Reference in New Issue