mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
right sidebar: Remove "GROUP PMs" section.
We remove the "GROUP PMs" section that used
to be in the lower right sidebar.
Most of this is straightforward code removal.
A couple quick notes:
- The message fetching code now just
calls `huddle_data.process_loaded_messages`,
which we still need for search suggestions.
We removed `activity.process_loaded_messages`.
- The `huddle_data.process_loaded_messages`
function no longer needs to return `need_resize`.
- In `resize.js` we now just calculate
`res.buddy_list_wrapper_max_height` directly
from `usable_height`.
This commit is contained in:
@@ -132,9 +132,6 @@ people.add_active_user(zoe);
|
||||
people.add_active_user(me);
|
||||
people.initialize_current_user(me.user_id);
|
||||
|
||||
const real_update_huddles = activity.update_huddles;
|
||||
activity.update_huddles = () => {};
|
||||
|
||||
const presence_info = new Map();
|
||||
presence_info.set(alice.user_id, { status: 'inactive' });
|
||||
presence_info.set(fred.user_id, { status: 'active' });
|
||||
@@ -176,7 +173,8 @@ run_test('sort_users', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
run_test('process_loaded_messages', () => {
|
||||
run_test('huddle_data.process_loaded_messages', () => {
|
||||
// TODO: move this to a module for just testing `huddle_data`
|
||||
|
||||
const huddle1 = 'jill@zulip.com,norbert@zulip.com';
|
||||
const timestamp1 = 1382479029; // older
|
||||
@@ -211,56 +209,13 @@ run_test('process_loaded_messages', () => {
|
||||
},
|
||||
];
|
||||
|
||||
activity.process_loaded_messages(messages);
|
||||
huddle_data.process_loaded_messages(messages);
|
||||
|
||||
const user_ids_string1 = people.emails_strings_to_user_ids_string(huddle1);
|
||||
const user_ids_string2 = people.emails_strings_to_user_ids_string(huddle2);
|
||||
assert.deepEqual(huddle_data.get_huddles(), [user_ids_string2, user_ids_string1]);
|
||||
});
|
||||
|
||||
run_test('full_huddle_name', () => {
|
||||
function full_name(emails_string) {
|
||||
const user_ids_string = people.emails_strings_to_user_ids_string(emails_string);
|
||||
return activity.full_huddle_name(user_ids_string);
|
||||
}
|
||||
|
||||
assert.equal(
|
||||
full_name('alice@zulip.com,jill@zulip.com'),
|
||||
'Alice Smith, Jill Hill');
|
||||
|
||||
assert.equal(
|
||||
full_name('alice@zulip.com,fred@zulip.com,jill@zulip.com'),
|
||||
'Alice Smith, Fred Flintstone, Jill Hill');
|
||||
});
|
||||
|
||||
run_test('short_huddle_name', () => {
|
||||
function short_name(emails_string) {
|
||||
const user_ids_string = people.emails_strings_to_user_ids_string(emails_string);
|
||||
return activity.short_huddle_name(user_ids_string);
|
||||
}
|
||||
|
||||
assert.equal(
|
||||
short_name('alice@zulip.com'),
|
||||
'Alice Smith');
|
||||
|
||||
assert.equal(
|
||||
short_name('alice@zulip.com,jill@zulip.com'),
|
||||
'Alice Smith, Jill Hill');
|
||||
|
||||
assert.equal(
|
||||
short_name('alice@zulip.com,fred@zulip.com,jill@zulip.com'),
|
||||
'Alice Smith, Fred Flintstone, Jill Hill');
|
||||
|
||||
assert.equal(
|
||||
short_name('alice@zulip.com,fred@zulip.com,jill@zulip.com,mark@zulip.com'),
|
||||
'Alice Smith, Fred Flintstone, Jill Hill, + 1 other');
|
||||
|
||||
assert.equal(
|
||||
short_name('alice@zulip.com,fred@zulip.com,jill@zulip.com,mark@zulip.com,norbert@zulip.com'),
|
||||
'Alice Smith, Fred Flintstone, Jill Hill, + 2 others');
|
||||
|
||||
});
|
||||
|
||||
presence.presence_info = new Map();
|
||||
presence.presence_info.set(alice.user_id, { status: activity.IDLE });
|
||||
presence.presence_info.set(fred.user_id, { status: activity.ACTIVE });
|
||||
@@ -354,31 +309,6 @@ run_test('PM_update_dom_counts', () => {
|
||||
assert.equal(value.text(), '');
|
||||
});
|
||||
|
||||
run_test('group_update_dom_counts', () => {
|
||||
const value = $.create('alice-fred-value');
|
||||
const count = $.create('alice-fred-count');
|
||||
const pm_key = alice.user_id.toString() + "," + fred.user_id.toString();
|
||||
const li_selector = "li.group-pms-sidebar-entry[data-user-ids='" + pm_key + "']";
|
||||
const li = $(li_selector);
|
||||
count.set_find_results('.value', value);
|
||||
li.set_find_results('.count', count);
|
||||
count.set_parent(li);
|
||||
|
||||
const counts = new Map();
|
||||
counts.set(pm_key, 5);
|
||||
li.addClass('group-pms-sidebar-entry');
|
||||
|
||||
activity.update_dom_with_unread_counts({pm_count: counts});
|
||||
assert(li.hasClass('group-with-count'));
|
||||
assert.equal(value.text(), "5");
|
||||
|
||||
counts.set(pm_key, 0);
|
||||
|
||||
activity.update_dom_with_unread_counts({pm_count: counts});
|
||||
assert(!li.hasClass('group-with-count'));
|
||||
assert.equal(value.text(), '');
|
||||
});
|
||||
|
||||
run_test('handlers', () => {
|
||||
// This is kind of weak coverage; we are mostly making sure that
|
||||
// keys and clicks got mapped to functions that don't crash.
|
||||
@@ -652,8 +582,6 @@ run_test('realm_presence_disabled', () => {
|
||||
|
||||
activity.redraw_user();
|
||||
activity.build_user_sidebar();
|
||||
|
||||
real_update_huddles();
|
||||
});
|
||||
|
||||
run_test('clear_search', () => {
|
||||
@@ -706,34 +634,11 @@ run_test('searching', () => {
|
||||
assert.equal(activity.searching(), false);
|
||||
});
|
||||
|
||||
run_test('update_huddles_and_redraw', () => {
|
||||
const value = $.create('alice-fred-value');
|
||||
const count = $.create('alice-fred-count');
|
||||
const pm_key = alice.user_id.toString() + "," + fred.user_id.toString();
|
||||
const li_selector = "li.group-pms-sidebar-entry[data-user-ids='" + pm_key + "']";
|
||||
const li = $(li_selector);
|
||||
count.set_find_results('.value', value);
|
||||
li.set_find_results('.count', count);
|
||||
count.set_parent(li);
|
||||
|
||||
const real_get_huddles = huddle_data.get_huddles;
|
||||
huddle_data.get_huddles = () => ['1,2'];
|
||||
activity.update_huddles = real_update_huddles;
|
||||
activity.redraw();
|
||||
assert.equal($('#group-pm-list').hasClass('show'), false);
|
||||
page_params.realm_presence_disabled = false;
|
||||
activity.redraw();
|
||||
assert.equal($('#group-pm-list').hasClass('show'), true);
|
||||
huddle_data.get_huddles = () => [];
|
||||
activity.redraw();
|
||||
assert.equal($('#group-pm-list').hasClass('show'), false);
|
||||
huddle_data.get_huddles = real_get_huddles;
|
||||
activity.update_huddles = function () {};
|
||||
});
|
||||
|
||||
reset_setup();
|
||||
|
||||
run_test('update_presence_info', () => {
|
||||
page_params.realm_presence_disabled = false;
|
||||
|
||||
const server_time = 500;
|
||||
const info = {
|
||||
website: {
|
||||
|
||||
@@ -416,7 +416,7 @@ run_test('insert_message', () => {
|
||||
|
||||
assert.equal(message_store.get(new_message.id), undefined);
|
||||
|
||||
helper.redirect('activity', 'process_loaded_messages');
|
||||
helper.redirect('huddle_data', 'process_loaded_messages');
|
||||
helper.redirect('message_util', 'add_new_messages');
|
||||
helper.redirect('notifications', 'received_messages');
|
||||
helper.redirect('resize', 'resize_page_components');
|
||||
@@ -433,9 +433,9 @@ run_test('insert_message', () => {
|
||||
// the code invokes various objects when a new message
|
||||
// comes in:
|
||||
assert.deepEqual(helper.events, [
|
||||
'huddle_data.process_loaded_messages',
|
||||
'message_util.add_new_messages',
|
||||
'message_util.add_new_messages',
|
||||
'activity.process_loaded_messages',
|
||||
'unread_ui.update_unread_counts',
|
||||
'resize.resize_page_components',
|
||||
'unread_ops.process_visible',
|
||||
|
||||
Reference in New Issue
Block a user