models: Refactor get_fake_email_domain to take realm.host as arg.

This commit updates get_fake_email_domain to accept realm.host as
argument instead of the Realm object since we only use realm.host
to get the fake email domain.

This is a preparatory commit for the limited guest feature as we
would be sending the fake email of the message sender in message
event object to a guest user who cannot access the sender and
there we would need to compute the fake email.
This commit is contained in:
Sahil Batra
2023-11-07 12:42:19 +05:30
committed by Tim Abbott
parent 7da68259a6
commit a6fa875c23
5 changed files with 16 additions and 14 deletions

View File

@@ -796,7 +796,9 @@ def get_cross_realm_dicts() -> List[APIUserDict]:
def get_data_for_inaccessible_user(realm: Realm, user_id: int) -> APIUserDict:
fake_email = Address(username=f"user{user_id}", domain=get_fake_email_domain(realm)).addr_spec
fake_email = Address(
username=f"user{user_id}", domain=get_fake_email_domain(realm.host)
).addr_spec
# We just set date_joined field to UNIX epoch.
user_date_joined = timestamp_to_datetime(0)