Skip to content

Commit 37e9775

Browse files
committed
WIP: model: Extract server aggregate status and use it by default.
1 parent 6507d48 commit 37e9775

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
@@ -1193,22 +1193,25 @@ def _update_users_data_from_initial_data(self) -> None:
11931193
* UserStatus, an arbitrary one is chosen.
11941194
"""
11951195
aggregate_status: UserStatus = "offline"
1196+
server_aggregate_status = "offline"
11961197
for client_name, client_presence in presences[email].items():
11971198
status = client_presence["status"]
11981199
timestamp = client_presence["timestamp"]
1199-
if client_name == "aggregated":
1200-
continue
12011200
if (server_timestamp - timestamp) < OFFLINE_THRESHOLD_SECS:
1202-
if status == "active":
1203-
aggregate_status = "active"
1204-
if status == "idle" and aggregate_status != "active":
1205-
aggregate_status = status
1206-
if status == "offline" and (
1207-
aggregate_status != "active" and aggregate_status != "idle"
1208-
):
1209-
aggregate_status = status
1210-
1211-
status = aggregate_status
1201+
if client_name == "aggregated":
1202+
server_aggregate_status = status
1203+
else:
1204+
if status == "active":
1205+
aggregate_status = "active"
1206+
if status == "idle" and aggregate_status != "active":
1207+
aggregate_status = status
1208+
if status == "offline" and (
1209+
aggregate_status != "active"
1210+
and aggregate_status != "idle"
1211+
):
1212+
aggregate_status = status
1213+
1214+
status = server_aggregate_status
12121215
else:
12131216
# Set status of users not in the `presence` list
12141217
# as 'inactive'. They will not be displayed in the

0 commit comments

Comments
 (0)