Skip to content

Commit 29746fa

Browse files
committed
WIP: model: Extract server aggregate status and use it by default.
1 parent bd25970 commit 29746fa

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

zulipterminal/model.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,24 +1231,27 @@ def _update_users_data_from_initial_data(self) -> None:
12311231
* UserStatus, an arbitrary one is chosen.
12321232
"""
12331233
aggregate_status: UserStatus = "offline"
1234+
server_aggregate_status = "offline"
12341235
for client_name, client_presence in presences[email].items():
12351236
status = client_presence["status"]
12361237
timestamp = client_presence["timestamp"]
1237-
if client_name == "aggregated":
1238-
continue
12391238
if (
12401239
server_timestamp - timestamp
12411240
) < self.server_presence_offline_threshold_secs:
1242-
if status == "active":
1243-
aggregate_status = "active"
1244-
if status == "idle" and aggregate_status != "active":
1245-
aggregate_status = status
1246-
if status == "offline" and (
1247-
aggregate_status != "active" and aggregate_status != "idle"
1248-
):
1249-
aggregate_status = status
1250-
1251-
status = aggregate_status
1241+
if client_name == "aggregated":
1242+
server_aggregate_status = status
1243+
else:
1244+
if status == "active":
1245+
aggregate_status = "active"
1246+
if status == "idle" and aggregate_status != "active":
1247+
aggregate_status = status
1248+
if status == "offline" and (
1249+
aggregate_status != "active"
1250+
and aggregate_status != "idle"
1251+
):
1252+
aggregate_status = status
1253+
1254+
status = server_aggregate_status
12521255
else:
12531256
# Set status of users not in the `presence` list
12541257
# as 'inactive'. They will not be displayed in the

0 commit comments

Comments
 (0)