mirror of https://github.com/zulip/zulip.git
settings_users: Refactor logic for "last active" column in users table.
This uses "last_active" attribute of `user` (`item`) object and makes code much more readable.
This commit is contained in:
parent
a3ef8856a8
commit
c0c11fe226
|
@ -176,18 +176,13 @@ function populate_users(realm_people_data) {
|
|||
modifier: function (item) {
|
||||
var activity_rendered;
|
||||
var today = new XDate();
|
||||
if (presence.presence_info[item.user_id]) {
|
||||
// XDate takes number of milliseconds since UTC epoch.
|
||||
var last_active = presence.presence_info[item.user_id].last_active * 1000;
|
||||
|
||||
if (!isNaN(last_active)) {
|
||||
var last_active_date = new XDate(last_active);
|
||||
activity_rendered = timerender.render_date(last_active_date, undefined, today);
|
||||
} else {
|
||||
activity_rendered = $("<span></span>").text(i18n.t("Never"));
|
||||
}
|
||||
} else {
|
||||
if (item.last_active === LAST_ACTIVE_UNKNOWN) {
|
||||
activity_rendered = $("<span></span>").text(i18n.t("Unknown"));
|
||||
} else if (item.last_active === LAST_ACTIVE_NEVER) {
|
||||
activity_rendered = $("<span></span>").text(i18n.t("Never"));
|
||||
} else {
|
||||
activity_rendered = timerender.render_date(
|
||||
new XDate(item.last_active * 1000), undefined, today);
|
||||
}
|
||||
|
||||
var $row = $(render_admin_user_list({
|
||||
|
|
Loading…
Reference in New Issue