refactor: Avoid positional params for MessageList.

We used to have positional parameters for table_name
and filter, but we don't use them for message_list.all
and we're about to replace filter in some cases.

Passing everything in on opts is more consistent and
self-documenting in the calling code, plus lots of
unit tests can get away with passing in `{}` now
for situations where table_name does not matter.

All of our callers pass in muting_enabled, so we
remove the default value for it.  And then the
collapse_messages variable doesn't have to live on
`this` as it's only being passed through down to the
view.
This commit is contained in:
Steve Howell
2018-05-14 13:46:25 +00:00
committed by Tim Abbott
parent f61ecef138
commit a3d3d08a80
7 changed files with 51 additions and 69 deletions

View File

@@ -2,12 +2,11 @@
// global variables from Zulip (everything is being moved into
// modules). Please don't add things here.
var home_msg_list = new message_list.MessageList(
'zhome',
new Filter([{operator: "in",
operand: "home"}]),
{muting_enabled: true}
);
var home_msg_list = new message_list.MessageList({
table_name: 'zhome',
filter: new Filter([{operator: "in", operand: "home"}]),
muting_enabled: true,
});
var current_msg_list = home_msg_list;
if (typeof module !== 'undefined') {