create_user: Remove redundant argument of get_display_email_address.

This commit is contained in:
Mateusz Mandera 2020-12-19 17:51:38 +01:00 committed by Tim Abbott
parent c693ae8982
commit b15dd9147d
3 changed files with 5 additions and 5 deletions

View File

@ -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)
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
send_user_email_update_event(user_profile)
UserProfile.objects.bulk_update(user_profiles, ['email'])

View File

@ -41,7 +41,7 @@ def bulk_create_users(realm: Realm,
UserProfile.objects.bulk_create(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'])
user_ids = {user.id for user in profiles_to_create}

View File

@ -45,7 +45,7 @@ def copy_user_settings(source_profile: UserProfile, target_profile: UserProfile)
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():
return f"user{user_profile.id}@{get_fake_email_domain()}"
return user_profile.delivery_email
@ -98,7 +98,7 @@ def create_user_profile(realm: Realm, email: str, password: Optional[str],
password = None
if user_profile.email_address_is_realm_public():
# 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.api_key = generate_api_key()
return user_profile
@ -159,7 +159,7 @@ def create_user(email: str,
# With restricted access to email addresses, we can't generate
# the fake email addresses we use for display purposes without
# 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'])
recipient = Recipient.objects.create(type_id=user_profile.id,