Skip to content

Commit 60fa8f2

Browse files
committed
WIP: model: Extract server aggregate status and use it by default.
1 parent dce79bd commit 60fa8f2

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
@@ -1061,22 +1061,25 @@ def get_all_users(self) -> List[Dict[str, Any]]:
10611061
* UserStatus, an arbitrary one is chosen.
10621062
"""
10631063
aggregate_status = "offline"
1064+
server_aggregate_status = "offline"
10641065
for client_name, client_presence in presences[email].items():
10651066
status = client_presence["status"]
10661067
timestamp = client_presence["timestamp"]
1067-
if client_name == "aggregated":
1068-
continue
10691068
if (server_timestamp - timestamp) < OFFLINE_THRESHOLD_SECS:
1070-
if status == "active":
1071-
aggregate_status = "active"
1072-
if status == "idle" and aggregate_status != "active":
1073-
aggregate_status = status
1074-
if status == "offline" and (
1075-
aggregate_status != "active" and aggregate_status != "idle"
1076-
):
1077-
aggregate_status = status
1078-
1079-
status = aggregate_status
1069+
if client_name == "aggregated":
1070+
server_aggregate_status = status
1071+
else:
1072+
if status == "active":
1073+
aggregate_status = "active"
1074+
if status == "idle" and aggregate_status != "active":
1075+
aggregate_status = status
1076+
if status == "offline" and (
1077+
aggregate_status != "active"
1078+
and aggregate_status != "idle"
1079+
):
1080+
aggregate_status = status
1081+
1082+
status = server_aggregate_status
10801083
else:
10811084
# Set status of users not in the `presence` list
10821085
# as 'inactive'. They will not be displayed in the

0 commit comments

Comments
 (0)