Skip to content

Commit 359dd01

Browse files
committed
model: Update data of current user for realm_user update events.
This commit updates Model.initial_data when the realm_user: update event occurs for the current user.
1 parent 6cfeae4 commit 359dd01

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

zulipterminal/model.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,12 @@ def _handle_realm_user_event(self, event: Event) -> None:
18411841
if "new_email" in event["person"]:
18421842
event["person"]["email"] = event["person"].pop("new_email")
18431843
updated_details = event["person"]
1844+
# Role is not present under self.initial_data,
1845+
# but exists only under self.initial_data["realm_users"]
1846+
if "role" not in event["person"]:
1847+
# check if the event contains details of current user or some other user in the org
1848+
if updated_details["user_id"] == self.user_id:
1849+
self.initial_data.update(updated_details)
18441850
for realm_user in self.initial_data["realm_users"]:
18451851
if realm_user["user_id"] == updated_details["user_id"]:
18461852
realm_user.update(updated_details)

0 commit comments

Comments
 (0)