Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user fetch: Pass realm_id to format_user_row.

Steve Howell1c607f84678e
diff --git a/zerver/actions/create_user.py b/zerver/actions/create_user.py
index fffce761168..099fe1c3b05 100644
--- a/zerver/actions/create_user.py
+++ b/zerver/actions/create_user.py
@@ -298,7 +298,7 @@ def notify_created_user(user_profile: UserProfile) -> None:
user_row = user_profile_to_user_row(user_profile)
format_user_row_kwargs: Dict[str, Any] = {
- "realm": user_profile.realm,
+ "realm_id": user_profile.realm_id,
"row": user_row,
# Since we don't know what the client
# supports at this point in the code, we
diff --git a/zerver/lib/users.py b/zerver/lib/users.py
index be3c5a0cd22..2604f457c64 100644
--- a/zerver/lib/users.py
+++ b/zerver/lib/users.py
@@ -426,7 +426,7 @@ def can_access_delivery_email(
def format_user_row(
- realm: Realm,
+ realm_id: int,
acting_user: Optional[UserProfile],
row: Dict[str, Any],
client_gravatar: bool,
@@ -489,7 +489,7 @@ def format_user_row(
if include_avatar_url:
result["avatar_url"] = get_avatar_field(
user_id=row["id"],
- realm_id=realm.id,
+ realm_id=realm_id,
email=row["delivery_email"],
avatar_source=row["avatar_source"],
avatar_version=row["avatar_version"],
@@ -559,7 +559,7 @@ def get_cross_realm_dicts() -> List[Dict[str, Any]]:
result.append(
format_user_row(
- user.realm,
+ user.realm_id,
acting_user=user,
row=user_row,
client_gravatar=False,
@@ -629,7 +629,7 @@ def get_raw_user_data(
and row["email_address_visibility"] == UserProfile.EMAIL_ADDRESS_VISIBILITY_EVERYONE
)
result[row["id"]] = format_user_row(
- realm,
+ realm.id,
acting_user=acting_user,
row=row,
client_gravatar=client_gravatar_for_user,