user_status: Iterate over page_params.user_status with Object.entries.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-06 03:31:32 +00:00 committed by Tim Abbott
parent 5564b39ea4
commit dd10108c24
2 changed files with 3 additions and 2 deletions

View File

@ -144,6 +144,7 @@ page_params.never_subscribed = [];
page_params.realm_notifications_stream_id = -1;
page_params.unread_msgs = {};
page_params.recent_private_conversations = [];
page_params.user_status = {};
$('#tab_bar').append = () => {};
$('#compose').filedrop = () => {};

View File

@ -59,7 +59,7 @@ exports.set_status_text = function (opts) {
};
exports.initialize = function () {
_.each(page_params.user_status, function (dct, str_user_id) {
for (const [str_user_id, dct] of Object.entries(page_params.user_status)) {
// JSON does not allow integer keys, so we
// convert them here.
const user_id = parseInt(str_user_id, 10);
@ -71,7 +71,7 @@ exports.initialize = function () {
if (dct.status_text) {
user_info.set(user_id, dct.status_text);
}
});
}
delete page_params.user_status;
};