mirror of https://github.com/zulip/zulip.git
left sidebar: Fix bot availability status in "private messages".
This changes the availability icon for bot users to user_circle_green; previously it was accidentally defaulting to user_circle_empty, making it appear that bots were never available. Fixes #13149.
This commit is contained in:
parent
75d579847e
commit
cf5d3a3ef3
|
@ -41,9 +41,17 @@ var me = {
|
|||
user_id: 103,
|
||||
full_name: 'Me Myself',
|
||||
};
|
||||
var bot_test = {
|
||||
email: 'outgoingwebhook@zulip.com',
|
||||
user_id: 314,
|
||||
full_name: "Outgoing webhook",
|
||||
is_admin: false,
|
||||
is_bot: true,
|
||||
};
|
||||
global.people.add_in_realm(alice);
|
||||
global.people.add_in_realm(bob);
|
||||
global.people.add_in_realm(me);
|
||||
global.people.add_in_realm(bot_test);
|
||||
global.people.initialize_current_user(me.user_id);
|
||||
|
||||
run_test('get_conversation_li', () => {
|
||||
|
@ -113,6 +121,53 @@ run_test('build_private_messages_list', () => {
|
|||
assert.deepEqual(template_data, expected_data);
|
||||
});
|
||||
|
||||
run_test('build_private_messages_list_bot', () => {
|
||||
var active_conversation_1 = 'outgoingwebhook@zulip.com';
|
||||
var max_conversations = 5;
|
||||
|
||||
var user_ids_string = '314';
|
||||
var timestamp = 0;
|
||||
pm_conversations.recent.insert(user_ids_string, timestamp);
|
||||
|
||||
global.unread.num_unread_for_person = function () {
|
||||
return 1;
|
||||
};
|
||||
|
||||
var template_data;
|
||||
global.stub_templates(function (template_name, data) {
|
||||
assert.equal(template_name, 'sidebar_private_message_list');
|
||||
template_data = data;
|
||||
});
|
||||
|
||||
pm_list._build_private_messages_list(active_conversation_1, max_conversations);
|
||||
var expected_data = {
|
||||
messages: [
|
||||
{
|
||||
recipients: 'Outgoing webhook',
|
||||
user_ids_string: '314',
|
||||
unread: 1,
|
||||
is_zero: false,
|
||||
url: '#narrow/pm-with/314-outgoingwebhook',
|
||||
user_circle_class: 'user_circle_green',
|
||||
fraction_present: undefined,
|
||||
is_group: false,
|
||||
},
|
||||
{
|
||||
recipients: 'Alice, Bob',
|
||||
user_ids_string: '101,102',
|
||||
unread: 1,
|
||||
is_zero: false,
|
||||
url: '#narrow/pm-with/101,102-group',
|
||||
user_circle_class: 'user_circle_fraction',
|
||||
fraction_present: false,
|
||||
is_group: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
assert.deepEqual(template_data, expected_data);
|
||||
});
|
||||
|
||||
run_test('expand_and_update_private_messages', () => {
|
||||
global.stub_templates(function (template_name) {
|
||||
assert.equal(template_name, 'sidebar_private_message_list');
|
||||
|
|
|
@ -93,6 +93,12 @@ exports._build_private_messages_list = function (active_conversation) {
|
|||
if (is_group) {
|
||||
user_circle_class = 'user_circle_fraction';
|
||||
fraction_present = buddy_data.huddle_fraction_present(user_ids_string);
|
||||
} else {
|
||||
var recipient_user_obj = people.get_person_from_user_id(user_ids_string);
|
||||
|
||||
if (recipient_user_obj.is_bot) {
|
||||
user_circle_class = 'user_circle_green';
|
||||
}
|
||||
}
|
||||
|
||||
var display_message = {
|
||||
|
|
Loading…
Reference in New Issue