Skip to content

Commit 9f75b0f

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 3bbf185 commit 9f75b0f

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
@@ -1755,6 +1755,12 @@ def _handle_realm_user_event_update(self, event: Event) -> None:
17551755
assert event["type"] == "realm_user"
17561756
if event["op"] == "update":
17571757
updated_details = event["person"]
1758+
# Role is not present under self.initial_data,
1759+
# but exists only under self.initial_data["realm_users"]
1760+
if "role" not in event["person"]:
1761+
# check if the event contains details of current user or some other user in the org
1762+
if updated_details["user_id"] == self.user_id:
1763+
self.initial_data.update(updated_details)
17581764
for realm_user in self.initial_data["realm_users"]:
17591765
if realm_user["user_id"] == updated_details["user_id"]:
17601766
realm_user.update(updated_details)

0 commit comments

Comments
 (0)