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

@@ -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,