Make message_list.js work like the other modules.

This commit is contained in:
Vishnu Ks 2016-04-21 02:07:26 +05:30 committed by Tim Abbott
parent 28d1a3105c
commit ee39f5009f
5 changed files with 16 additions and 11 deletions

View File

@ -19,7 +19,7 @@ set_global('$', function () {
set_global('feature_flags', {});
var MessageList = require('js/message_list');
var MessageList = require('js/message_list').MessageList;
(function test_basics() {
var table;

View File

@ -1,5 +1,9 @@
/*jslint nomen: true */
function MessageList(table_name, filter, opts) {
var message_list = (function () {
var exports = {};
exports.MessageList = function (table_name, filter, opts) {
_.extend(this, {
collapse_messages: true,
muting_enabled: true
@ -25,11 +29,9 @@ function MessageList(table_name, filter, opts) {
this.num_appends = 0;
return this;
}
};
(function () {
MessageList.prototype = {
exports.MessageList.prototype = {
add_messages: function MessageList_add_messages(messages, opts) {
var self = this;
var predicate = self.filter.predicate();
@ -627,8 +629,11 @@ MessageList.prototype = {
$(document).on('message_selected.zulip hashchange.zulip mousewheel', function (event) {
viewport.stop_auto_scrolling();
});
return exports;
}());
/*jslint nomen: false */
if (typeof module !== 'undefined') {
module.exports = MessageList;
module.exports = message_list;
}

View File

@ -244,7 +244,7 @@ exports.activate = function (raw_operators, opts) {
home_msg_list.pre_narrow_offset = page_params.initial_offset;
}
var msg_list = new MessageList('zfilt', current_filter, {
var msg_list = new message_list.MessageList('zfilt', current_filter, {
collapse_messages: ! current_filter.is_search(),
muting_enabled: muting_enabled
});

View File

@ -1,8 +1,8 @@
var all_msg_list = new MessageList(
var all_msg_list = new message_list.MessageList(
undefined, undefined,
{muting_enabled: false}
);
var home_msg_list = new MessageList('zhome',
var home_msg_list = new message_list.MessageList('zhome',
new Filter([{operator: "in", operand: "home"}]), {muting_enabled: true}
);
var narrowed_msg_list;

View File

@ -24,7 +24,7 @@ var globals =
// Modules, defined in their respective files.
+ ' compose compose_fade rows hotkeys narrow reload search subs pointer'
+ ' composebox_typeahead server_events typeahead_helper notifications hashchange'
+ ' invite ui viewport util activity timerender MessageList MessageListView blueslip unread stream_list'
+ ' invite ui viewport util activity timerender message_list MessageListView blueslip unread stream_list'
+ ' message_edit tab_bar emoji popovers navigate people settings alert_words_ui message_store'
+ ' avatar feature_flags search_suggestion referral stream_color Dict'
+ ' Filter summary admin stream_data muting WinChan muting_ui Socket channel gear_menu'