user_popover: Handle the case when user presence is unknown.

For bots and users who have not logged in for a long time the presence information is not known. For the these users make the presence indicator hidden.
This commit is contained in:
Vishnu Ks
2017-06-19 22:33:39 +05:30
committed by showell
parent dfbf8b8086
commit 9b16835c99
4 changed files with 15 additions and 6 deletions

View File

@@ -113,6 +113,7 @@ presence.presence_info = presence_info;
assert.equal(presence.get_status(page_params.user_id), "active");
assert.equal(presence.get_status(alice.user_id), "inactive");
assert.equal(presence.get_status(fred.user_id), "active");
assert.equal(presence.get_status(zoe.user_id), "unknown");
}());
(function test_sort_users() {

View File

@@ -42,14 +42,15 @@ function load_medium_avatar(user_email) {
}
function user_last_seen_time_status(user_id) {
if (presence.get_status(user_id) === "active") {
var status = presence.get_status(user_id);
if (status === "active") {
return i18n.t("Active now");
}
if (people.get_person_from_user_id(user_id).is_bot) {
return i18n.t("Bot");
if (status === "unknown") {
// We are not using this anywhere right now as the user presence indicator
// is hidden for this case
return i18n.t("Unknown");
}
return timerender.last_seen_status_from_date(presence.last_active_date(user_id).clone());
}

View File

@@ -36,7 +36,10 @@ exports.get_status = function (user_id) {
if (user_id === page_params.user_id) {
return "active";
}
return exports.presence_info[user_id].status;
if (user_id in exports.presence_info) {
return exports.presence_info[user_id].status;
}
return "unknown";
};
exports.get_mobile = function (user_id) {

View File

@@ -79,6 +79,10 @@
border-color: gray;
}
.user_unknown .user-status-indicator {
display: none;
}
#user_presences a,
#group-pms a {
color: inherit;