Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

presence: Disable 'Idle' for users with idle status.

Tim Abbott746d3e8dcbfa
diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js
index a4e019d9f19..dae778ad7f2 100644
--- a/frontend_tests/node_tests/buddy_data.js
+++ b/frontend_tests/node_tests/buddy_data.js
@@ -529,6 +529,9 @@ test("user_last_seen_time_status", (override) => {
buddy_data.user_last_seen_time_status(old_user.user_id),
"translated: Last active: May 12",
);
+
+ set_presence(selma.user_id, "idle");
+ assert.equal(buddy_data.user_last_seen_time_status(selma.user_id), "translated: Idle");
});
test("get_items_for_users", () => {
diff --git a/static/js/buddy_data.js b/static/js/buddy_data.js
index 3a745fb85c6..bb85bd61949 100644
--- a/static/js/buddy_data.js
+++ b/static/js/buddy_data.js
@@ -145,6 +145,13 @@ export function user_last_seen_time_status(user_id) {
return $t({defaultMessage: "Active now"});
}
+ if (status === "idle") {
+ // When we complete our presence API rewrite to have the data
+ // plumbed, we may want to change this to also mention when
+ // they were last active.
+ return $t({defaultMessage: "Idle"});
+ }
+
const last_active_date = presence.last_active_date(user_id);
let last_seen;
if (page_params.realm_is_zephyr_mirror_realm) {