mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +00:00
presence: Rename activity.set_user_status().
We are trying to carve room for a more specific "user_status" concept, which refers to statuses that users specifically set, like "I'm away". So we call this function "update_presence_info", which reflects that it's more about actual "presence"--i.e. the user really is present in the browser, even though the actual human may not want to be disturbed.
This commit is contained in:
@@ -774,7 +774,7 @@ run_test('update_huddles_and_redraw', () => {
|
||||
|
||||
reset_setup();
|
||||
|
||||
run_test('set_user_status', () => {
|
||||
run_test('update_presence_info', () => {
|
||||
const server_time = 500;
|
||||
const info = {
|
||||
website: {
|
||||
@@ -794,21 +794,21 @@ run_test('set_user_status', () => {
|
||||
};
|
||||
|
||||
presence.presence_info[me.user_id] = undefined;
|
||||
activity.set_user_status(me.email, info, server_time);
|
||||
activity.update_presence_info(me.email, info, server_time);
|
||||
assert(inserted);
|
||||
assert.deepEqual(presence.presence_info[me.user_id].status, 'active');
|
||||
|
||||
presence.presence_info[alice.user_id] = undefined;
|
||||
activity.set_user_status(alice.email, info, server_time);
|
||||
activity.update_presence_info(alice.email, info, server_time);
|
||||
assert(inserted);
|
||||
|
||||
const expected = { status: 'active', mobile: false, last_active: 500 };
|
||||
assert.deepEqual(presence.presence_info[alice.user_id], expected);
|
||||
|
||||
activity.set_user_status(alice.email, info, server_time);
|
||||
activity.update_presence_info(alice.email, info, server_time);
|
||||
blueslip.set_test_data('warn', 'unknown email: foo@bar.com');
|
||||
blueslip.set_test_data('error', 'Unknown email for get_user_id: foo@bar.com');
|
||||
activity.set_user_status('foo@bar.com', info, server_time);
|
||||
activity.update_presence_info('foo@bar.com', info, server_time);
|
||||
assert(blueslip.get_test_logs('warn').length, 1);
|
||||
assert(blueslip.get_test_logs('error').length, 1);
|
||||
blueslip.clear_test_data();
|
||||
|
@@ -762,7 +762,7 @@ with_overrides(function (override) {
|
||||
var event = event_fixtures.presence;
|
||||
|
||||
global.with_stub(function (stub) {
|
||||
override('activity.set_user_status', stub.f);
|
||||
override('activity.update_presence_info', stub.f);
|
||||
dispatch(event);
|
||||
var args = stub.get_args('email', 'presence', 'server_time');
|
||||
assert_same(args.email, 'alice@example.com');
|
||||
|
@@ -380,7 +380,7 @@ exports.initialize = function () {
|
||||
ui.set_up_scrollbar($("#group-pms"));
|
||||
};
|
||||
|
||||
exports.set_user_status = function (email, info, server_time) {
|
||||
exports.update_presence_info = function (email, info, server_time) {
|
||||
var user_id = people.get_user_id(email);
|
||||
if (!user_id) {
|
||||
blueslip.warn('unknown email: ' + email);
|
||||
|
@@ -59,7 +59,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||
break;
|
||||
|
||||
case 'presence':
|
||||
activity.set_user_status(event.email, event.presence, event.server_timestamp);
|
||||
activity.update_presence_info(event.email, event.presence, event.server_timestamp);
|
||||
break;
|
||||
|
||||
case 'restart':
|
||||
|
Reference in New Issue
Block a user