mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -79,6 +79,10 @@
 | 
			
		||||
    border-color: gray;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.user_unknown .user-status-indicator {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#user_presences a,
 | 
			
		||||
#group-pms a {
 | 
			
		||||
    color: inherit;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user