mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
Refactor: Split up add_messages api.
We now have two functions:
add_new_messages
add_old_messages
This is a lot easier on the eyes, and it will also
prevent us from exceeding line length in future commits.
We also remove an unneeded stub in the narrow_activate
tests.
This commit is contained in:
@@ -423,8 +423,7 @@ run_test('insert_message', () => {
|
||||
assert.equal(message_store.get(new_message.id), undefined);
|
||||
|
||||
helper.redirect('activity', 'process_loaded_messages');
|
||||
helper.redirect('message_util', 'add_messages');
|
||||
helper.redirect('message_util', 'insert_new_messages');
|
||||
helper.redirect('message_util', 'add_new_messages');
|
||||
helper.redirect('notifications', 'received_messages');
|
||||
helper.redirect('resize', 'resize_page_components');
|
||||
helper.redirect('stream_list', 'update_streams_sidebar');
|
||||
@@ -440,8 +439,8 @@ run_test('insert_message', () => {
|
||||
// the code invokes various objects when a new message
|
||||
// comes in:
|
||||
assert.deepEqual(helper.events, [
|
||||
'message_util.add_messages',
|
||||
'message_util.add_messages',
|
||||
'message_util.add_new_messages',
|
||||
'message_util.add_new_messages',
|
||||
'activity.process_loaded_messages',
|
||||
'unread_ui.update_unread_counts',
|
||||
'resize.resize_page_components',
|
||||
@@ -474,7 +473,7 @@ run_test('insert_message', () => {
|
||||
These are reflected by the following calls:
|
||||
|
||||
stream_list.update_streams_sidebar
|
||||
message_util.add_messages
|
||||
message_util.add_new_messages
|
||||
activity.process_loaded_messages
|
||||
|
||||
For now, though, let's focus on another side effect
|
||||
|
||||
@@ -101,9 +101,9 @@ function config_process_results(messages) {
|
||||
assert.deepEqual(arg, messages);
|
||||
};
|
||||
|
||||
message_util.add_messages = function (new_messages, msg_list, opts) {
|
||||
message_util.add_old_messages = function (new_messages, msg_list) {
|
||||
assert.deepEqual(new_messages, messages);
|
||||
msg_list.add_messages(new_messages, opts);
|
||||
msg_list.add_messages(new_messages);
|
||||
};
|
||||
|
||||
activity.process_loaded_messages = function (arg) {
|
||||
|
||||
@@ -87,12 +87,6 @@ function test_helper() {
|
||||
|
||||
blueslip.debug = noop;
|
||||
|
||||
message_util.add_messages = (messages, target_list, opts) => {
|
||||
// The real function here doesn't do any more than this
|
||||
// that we care about here.
|
||||
target_list.add_messages(messages, opts);
|
||||
};
|
||||
|
||||
return {
|
||||
clear: () => {
|
||||
events = [];
|
||||
|
||||
Reference in New Issue
Block a user