presence.js: Remove var presence_info.

It would conflict with `exports.presence_info` after migration to an
ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-04 02:14:33 -04:00 committed by Tim Abbott
parent ba90834a7a
commit 653907e26a
1 changed files with 4 additions and 7 deletions

View File

@ -21,10 +21,8 @@ function is_mobile(device) {
} }
exports.is_active = function (user_id) { exports.is_active = function (user_id) {
var presence_info = exports.presence_info; if (exports.presence_info[user_id]) {
var status = exports.presence_info[user_id].status;
if (presence_info[user_id]) {
var status = presence_info[user_id].status;
if (status && status === "active") { if (status && status === "active") {
return true; return true;
} }
@ -134,14 +132,13 @@ exports.update_info_for_small_realm = function () {
// For small realms, we create presence info for users // For small realms, we create presence info for users
// that the server didn't include in its presence update. // that the server didn't include in its presence update.
var presence_info = exports.presence_info;
var persons = people.get_realm_persons(); var persons = people.get_realm_persons();
_.each(persons, function (person) { _.each(persons, function (person) {
var user_id = person.user_id; var user_id = person.user_id;
var status = "offline"; var status = "offline";
if (presence_info[user_id]) { if (exports.presence_info[user_id]) {
// this is normal, we have data for active // this is normal, we have data for active
// users that we don't want to clobber. // users that we don't want to clobber.
return; return;
@ -156,7 +153,7 @@ exports.update_info_for_small_realm = function () {
status = "active"; status = "active";
} }
presence_info[user_id] = { exports.presence_info[user_id] = {
status: status, status: status,
mobile: false, mobile: false,
last_active: undefined, last_active: undefined,