mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
presence: Use people.is_my_user_id() for check.
This is the preferred way to check that a user id belongs to the current user. We have a recent bug where the current user's circle doesn't turn green right away. It's not clear this is the fix, though. (It's hard to repro locally.)
This commit is contained in:
@@ -49,6 +49,10 @@ people.add_in_realm(zoe);
|
|||||||
people.add_in_realm(bot);
|
people.add_in_realm(bot);
|
||||||
people.initialize_current_user(me.user_id);
|
people.initialize_current_user(me.user_id);
|
||||||
|
|
||||||
|
run_test('my user', () => {
|
||||||
|
assert.equal(presence.get_status(me.user_id), 'active');
|
||||||
|
});
|
||||||
|
|
||||||
run_test('on_mobile_property', () => {
|
run_test('on_mobile_property', () => {
|
||||||
// TODO: move this test to a new test module directly testing presence.js
|
// TODO: move this test to a new test module directly testing presence.js
|
||||||
var status_from_timestamp = presence._status_from_timestamp;
|
var status_from_timestamp = presence._status_from_timestamp;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ exports.is_active = function (user_id) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.get_status = function (user_id) {
|
exports.get_status = function (user_id) {
|
||||||
if (user_id === page_params.user_id) {
|
if (people.is_my_user_id(user_id)) {
|
||||||
return "active";
|
return "active";
|
||||||
}
|
}
|
||||||
if (user_id in exports.presence_info) {
|
if (user_id in exports.presence_info) {
|
||||||
|
|||||||
Reference in New Issue
Block a user