diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index ae65ce7b9c..93c5b9fc6b 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -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']) diff --git a/zerver/lib/bulk_create.py b/zerver/lib/bulk_create.py index 2331f00833..ba82329aa5 100644 --- a/zerver/lib/bulk_create.py +++ b/zerver/lib/bulk_create.py @@ -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} diff --git a/zerver/lib/create_user.py b/zerver/lib/create_user.py index e573a204f4..4c658de3f2 100644 --- a/zerver/lib/create_user.py +++ b/zerver/lib/create_user.py @@ -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,