js: Move current_msg_list, home_msg_list to ES6 module message_lists.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-03-29 17:21:21 -07:00 committed by Tim Abbott
parent fbf5ff26af
commit d43ac7357a
61 changed files with 409 additions and 363 deletions

View File

@ -104,26 +104,16 @@
"yoda": "error"
},
"overrides": [
{
"files": ["frontend_tests/node_tests/**"],
"globals": {
"current_msg_list": false,
"home_msg_list": false
}
},
{
"files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"],
"globals": {
"$": false,
"current_msg_list": false,
"zulip_test": false
}
},
{
"files": ["static/js/**"],
"globals": {
"current_msg_list": true,
"home_msg_list": false,
"StripeCheckout": false,
"zxcvbn": false
}

View File

@ -39,9 +39,9 @@ mock_esm("../../static/js/common", {
mock_esm("../../static/js/unread_ops", {
notify_server_message_read: noop,
});
set_global("current_msg_list", {
can_mark_messages_read() {
return true;
mock_esm("../../static/js/message_lists", {
current: {
can_mark_messages_read: () => true,
},
});
@ -51,6 +51,7 @@ const compose_ui = zrequire("compose_ui");
const compose = zrequire("compose");
const compose_state = zrequire("compose_state");
const compose_actions = zrequire("compose_actions");
const message_lists = zrequire("message_lists");
const stream_data = zrequire("stream_data");
const start = compose_actions.start;
@ -231,7 +232,7 @@ test("respond_to_message", (override) => {
type: "private",
sender_id: person.user_id,
};
override(current_msg_list, "selected_message", () => msg);
override(message_lists.current, "selected_message", () => msg);
let opts = {
reply_type: "personal",
@ -267,7 +268,7 @@ test("reply_with_mention", (override) => {
sender_full_name: "Bob Roberts",
sender_id: 40,
};
override(current_msg_list, "selected_message", () => msg);
override(message_lists.current, "selected_message", () => msg);
let syntax_to_insert;
override(compose_ui, "insert_syntax_and_focus", (syntax) => {
@ -314,7 +315,7 @@ test("quote_and_reply", (override) => {
override_private_message_recipient(override);
let selected_message;
override(current_msg_list, "selected_message", () => selected_message);
override(message_lists.current, "selected_message", () => selected_message);
let expected_replacement;
let replaced;
@ -339,7 +340,7 @@ test("quote_and_reply", (override) => {
success_function = opts.success;
});
override(current_msg_list, "selected_id", () => 100);
override(message_lists.current, "selected_id", () => 100);
override(compose_ui, "insert_syntax_and_focus", (syntax) => {
assert.equal(syntax, "[Quoting…]\n");

View File

@ -32,6 +32,7 @@ const markdown = mock_esm("../../static/js/markdown");
const message_edit = mock_esm("../../static/js/message_edit");
const message_events = mock_esm("../../static/js/message_events");
const message_list = mock_esm("../../static/js/message_list");
const message_lists = mock_esm("../../static/js/message_lists");
const muting_ui = mock_esm("../../static/js/muting_ui");
const night_mode = mock_esm("../../static/js/night_mode");
const notifications = mock_esm("../../static/js/notifications");
@ -65,8 +66,8 @@ mock_esm("../../static/js/compose");
const electron_bridge = set_global("electron_bridge", {});
set_global("current_msg_list", {});
set_global("home_msg_list", {});
message_lists.current = {};
message_lists.home = {};
// page_params is highly coupled to dispatching now
@ -629,20 +630,20 @@ run_test("update_display_settings", (override) => {
dispatch(event);
assert_same(page_params.left_side_userlist, true);
// We alias message_list.narrowed to current_msg_list
// We alias message_list.narrowed to message_lists.current
// to make sure we get line coverage on re-rendering
// the current message list. The actual code tests
// that these two objects are equal. It is possible
// we want a better strategy for that, or at least
// a helper.
message_list.narrowed = current_msg_list;
message_list.narrowed = message_lists.current;
let called = false;
current_msg_list.rerender = () => {
message_lists.current.rerender = () => {
called = true;
};
override(home_msg_list, "rerender", noop);
override(message_lists.home, "rerender", noop);
event = event_fixtures.update_display_settings__twenty_four_hour_time;
page_params.twenty_four_hour_time = false;
dispatch(event);

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
@ -14,6 +14,7 @@ const event_fixtures = events.fixtures;
const test_user = events.test_user;
const compose_fade = mock_esm("../../static/js/compose_fade");
const message_lists = mock_esm("../../static/js/message_lists");
const narrow_state = mock_esm("../../static/js/narrow_state");
const overlays = mock_esm("../../static/js/overlays");
const settings_org = mock_esm("../../static/js/settings_org");
@ -21,7 +22,7 @@ const settings_streams = mock_esm("../../static/js/settings_streams");
const stream_events = mock_esm("../../static/js/stream_events");
const stream_list = mock_esm("../../static/js/stream_list");
const subs = mock_esm("../../static/js/subs");
set_global("current_msg_list", {});
message_lists.current = {};
const peer_data = zrequire("peer_data");
const people = zrequire("people");
@ -213,7 +214,7 @@ test("stream delete (normal)", (override) => {
narrow_state.is_for_stream_id = () => true;
let bookend_updates = 0;
override(current_msg_list, "update_trailing_bookend", () => {
override(message_lists.current, "update_trailing_bookend", () => {
bookend_updates += 1;
});
@ -254,7 +255,7 @@ test("stream delete (special streams)", (override) => {
override(subs, "remove_stream", noop);
override(settings_org, "sync_realm_settings", noop);
override(settings_streams, "update_default_streams_table", noop);
override(current_msg_list, "update_trailing_bookend", noop);
override(message_lists.current, "update_trailing_bookend", noop);
override(stream_list, "remove_sidebar_row", noop);
dispatch(event);

View File

@ -4,12 +4,13 @@ const {strict: assert} = require("assert");
const MockDate = require("mockdate");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
const markdown = mock_esm("../../static/js/markdown");
const message_lists = mock_esm("../../static/js/message_lists");
let disparities = [];
let messages_to_rerender = [];
@ -30,16 +31,16 @@ mock_esm("../../static/js/message_store", {
update_booleans: () => {},
});
set_global("home_msg_list", {
message_lists.home = {
view: {
rerender_messages: (msgs) => {
messages_to_rerender = msgs;
},
},
});
};
mock_esm("../../static/js/message_list");
set_global("current_msg_list", "");
message_lists.current = "";
const echo = zrequire("echo");
const people = zrequire("people");
@ -171,13 +172,13 @@ run_test("build_display_recipient", () => {
});
run_test("update_message_lists", () => {
home_msg_list.view = {};
message_lists.home.view = {};
const stub = make_stub();
const view_stub = make_stub();
home_msg_list.change_message_id = stub.f;
home_msg_list.view.change_message_id = view_stub.f;
message_lists.home.change_message_id = stub.f;
message_lists.home.view.change_message_id = view_stub.f;
echo.update_message_lists({old_id: 401, new_id: 402});

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
/*
@ -21,6 +21,7 @@ const {run_test} = require("../zjsunit/test");
// First we tell the compiler to skip certain modules and just
// replace them with {}.
const huddle_data = mock_esm("../../static/js/huddle_data");
const message_lists = mock_esm("../../static/js/message_lists");
const message_util = mock_esm("../../static/js/message_util");
const notifications = mock_esm("../../static/js/notifications");
const pm_list = mock_esm("../../static/js/pm_list");
@ -29,7 +30,7 @@ const stream_list = mock_esm("../../static/js/stream_list");
const unread_ops = mock_esm("../../static/js/unread_ops");
const unread_ui = mock_esm("../../static/js/unread_ui");
set_global("home_msg_list", {});
message_lists.home = {};
// And we will also test some real code, of course.
const message_events = zrequire("message_events");

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
/*
@ -51,20 +51,21 @@ const {run_test} = require("../zjsunit/test");
const channel = mock_esm("../../static/js/channel");
const message_list = mock_esm("../../static/js/message_list");
const message_lists = mock_esm("../../static/js/message_lists");
const message_viewport = mock_esm("../../static/js/message_viewport");
const notifications = mock_esm("../../static/js/notifications");
const overlays = mock_esm("../../static/js/overlays");
const unread_ui = mock_esm("../../static/js/unread_ui");
message_lists.current = {};
message_lists.home = {};
const message_store = zrequire("message_store");
const recent_topics = zrequire("recent_topics");
const stream_data = zrequire("stream_data");
const unread = zrequire("unread");
const unread_ops = zrequire("unread_ops");
const current_msg_list = set_global("current_msg_list", {});
const home_msg_list = set_global("home_msg_list", {});
const denmark_stream = {
color: "blue",
name: "Denmark",
@ -104,14 +105,14 @@ run_test("unread_ops", (override) => {
// Make us not be in a narrow (somewhat hackily).
message_list.narrowed = undefined;
// Set current_msg_list containing messages that can be marked read
override(current_msg_list, "all_messages", () => test_messages);
// Set message_lists.current containing messages that can be marked read
override(message_lists.current, "all_messages", () => test_messages);
// Ignore these interactions for now:
message_list.all = {
show_message_as_read() {},
};
override(home_msg_list, "show_message_as_read", () => {});
override(message_lists.home, "show_message_as_read", () => {});
override(notifications, "close_notification", () => {});
override(unread_ui, "update_unread_counts", () => {});
@ -129,7 +130,7 @@ run_test("unread_ops", (override) => {
// Set up an override to point to the above var, so we can
// toggle it easily from within the test (and avoid complicated
// data setup).
override(current_msg_list, "can_mark_messages_read", () => can_mark_messages_read);
override(message_lists.current, "can_mark_messages_read", () => can_mark_messages_read);
// First, test for a message list that cannot read messages.
can_mark_messages_read = false;

View File

@ -54,6 +54,7 @@ const gear_menu = mock_esm("../../static/js/gear_menu", {
const lightbox = mock_esm("../../static/js/lightbox");
const list_util = mock_esm("../../static/js/list_util");
const message_edit = mock_esm("../../static/js/message_edit");
const message_lists = mock_esm("../../static/js/message_lists");
const muting_ui = mock_esm("../../static/js/muting_ui");
const narrow = mock_esm("../../static/js/narrow");
const navigate = mock_esm("../../static/js/navigate");
@ -95,7 +96,7 @@ mock_esm("../../static/js/recent_topics", {
is_visible: () => false,
});
set_global("current_msg_list", {
message_lists.current = {
empty() {
return false;
},
@ -112,7 +113,7 @@ set_global("current_msg_list", {
get_row() {
return 101;
},
});
};
const emoji_codes = zrequire("../generated/emoji/emoji_codes.json");
const emoji = zrequire("../shared/js/emoji");
@ -331,7 +332,7 @@ run_test("misc", () => {
// Check that they do nothing without a selected message
with_overrides((override) => {
override(current_msg_list, "empty", () => true);
override(message_lists.current, "empty", () => true);
assert_unmapped(message_view_only_keys);
});
@ -440,7 +441,7 @@ run_test("motion_keys", () => {
}
list_util.inside_list = () => false;
current_msg_list.empty = () => true;
message_lists.current.empty = () => true;
overlays.settings_open = () => false;
overlays.streams_open = () => false;
overlays.lightbox_open = () => false;
@ -458,7 +459,7 @@ run_test("motion_keys", () => {
assert_mapping("down_arrow", list_util, "go_down");
list_util.inside_list = () => false;
current_msg_list.empty = () => false;
message_lists.current.empty = () => false;
assert_mapping("down_arrow", navigate, "down");
assert_mapping("end", navigate, "to_end");
assert_mapping("home", navigate, "to_home");

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const $ = require("../zjsunit/zjquery");
const {page_params} = require("../zjsunit/zpage_params");
@ -11,11 +11,12 @@ mock_cjs("jquery", $);
const condense = mock_esm("../../static/js/condense");
const message_edit = mock_esm("../../static/js/message_edit");
const message_list = mock_esm("../../static/js/message_list");
const message_lists = mock_esm("../../static/js/message_lists");
const notifications = mock_esm("../../static/js/notifications");
const pm_list = mock_esm("../../static/js/pm_list");
const stream_list = mock_esm("../../static/js/stream_list");
const unread_ui = mock_esm("../../static/js/unread_ui");
set_global("current_msg_list", {});
message_lists.current = {};
const people = zrequire("people");
const message_events = zrequire("message_events");
@ -90,15 +91,15 @@ run_test("update_messages", () => {
},
];
current_msg_list.get_row = (message_id) => {
message_lists.current.get_row = (message_id) => {
assert.equal(message_id, 111);
return ["row-stub"];
};
current_msg_list.view = {};
message_lists.current.view = {};
let rendered_mgs;
current_msg_list.view.rerender_messages = (msgs_to_rerender, message_content_edited) => {
message_lists.current.view.rerender_messages = (msgs_to_rerender, message_content_edited) => {
rendered_mgs = msgs_to_rerender;
assert.equal(message_content_edited, true);
};

View File

@ -30,6 +30,7 @@ mock_esm("../../static/js/ui_report", {
const channel = mock_esm("../../static/js/channel");
const message_helper = mock_esm("../../static/js/message_helper");
const message_lists = mock_esm("../../static/js/message_lists");
const message_store = mock_esm("../../static/js/message_store");
const message_util = mock_esm("../../static/js/message_util");
const pm_list = mock_esm("../../static/js/pm_list");
@ -80,10 +81,10 @@ function make_all_list() {
}
function reset_lists() {
set_global("home_msg_list", make_home_msg_list());
set_global("current_msg_list", home_msg_list);
message_lists.home = make_home_msg_list();
message_lists.current = message_lists.home;
message_list.__Rewire__("all", make_all_list());
stub_message_view(home_msg_list);
stub_message_view(message_lists.home);
stub_message_view(message_list.all);
}
@ -313,7 +314,7 @@ function simulate_narrow() {
table_name: "zfilt",
filter,
});
set_global("current_msg_list", msg_list);
message_lists.current = msg_list;
return msg_list;
}
@ -424,7 +425,7 @@ run_test("loading_newer", () => {
(function test_home() {
reset_lists();
const msg_list = home_msg_list;
const msg_list = message_lists.home;
const data = [
{

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
const {mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {mock_esm, with_field, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const channel = mock_esm("../../static/js/channel");
@ -20,10 +20,6 @@ run_test("starred", (override) => {
const message = {
id: 50,
};
set_global("current_msg_list", {
all_messages: () => [message],
is_search: () => false,
});
let ui_updated;
ui.update_starred_view = () => {

View File

@ -13,7 +13,9 @@ set_global("document", "document-stub");
const noop = () => {};
page_params.twenty_four_hour_time = false;
set_global("home_msg_list", "stub");
mock_esm("../../static/js/message_lists", {home: "stub"});
// timerender calls setInterval when imported
mock_esm("../../static/js/timerender", {
render_date(time1, time2) {

View File

@ -21,6 +21,13 @@ const message_list = mock_esm("../../static/js/message_list", {
message_list.narrowed = value;
},
});
const message_lists = mock_esm("../../static/js/message_lists", {
home: {},
current: {},
set_current(msg_list) {
message_lists.current = msg_list;
},
});
const message_scroll = mock_esm("../../static/js/message_scroll");
const message_view_header = mock_esm("../../static/js/message_view_header");
const notifications = mock_esm("../../static/js/notifications");
@ -34,8 +41,6 @@ mock_esm("../../static/js/recent_topics", {
hide: () => {},
is_visible: () => {},
});
set_global("current_msg_list", {});
set_global("home_msg_list", {});
//
// We have strange hacks in narrow.activate to sleep 0
@ -151,8 +156,8 @@ run_test("basics", () => {
offset: () => ({top: 25}),
};
current_msg_list.selected_id = () => -1;
current_msg_list.get_row = () => row;
message_lists.current.selected_id = () => -1;
message_lists.current.get_row = () => row;
message_list.all = {
all_messages: () => messages,
@ -206,8 +211,8 @@ run_test("basics", () => {
[message_view_header, "initialize"],
]);
current_msg_list.selected_id = () => -1;
current_msg_list.get_row = () => row;
message_lists.current.selected_id = () => -1;
message_lists.current.get_row = () => row;
util.sorted_ids = () => [];
narrow.activate([{operator: "is", operand: "private"}], {

View File

@ -17,6 +17,9 @@ const stream_data = mock_esm("../../static/js/stream_data");
mock_esm("../../static/js/emoji_picker", {
hide_emoji_popover: noop,
});
const message_lists = mock_esm("../../static/js/message_lists", {
current: {},
});
mock_esm("../../static/js/message_viewport", {
height: () => 500,
});
@ -28,7 +31,6 @@ mock_esm("../../static/js/stream_popover", {
hide_streamlist_sidebar: noop,
});
set_global("current_msg_list", {});
page_params.is_admin = false;
page_params.realm_email_address_visibility = 3;
page_params.custom_profile_fields = [];
@ -119,12 +121,12 @@ test_ui("sender_hover", (override) => {
rows.id = () => message.id;
current_msg_list.get = (msg_id) => {
message_lists.current.get = (msg_id) => {
assert.equal(msg_id, message.id);
return message;
};
current_msg_list.select_id = (msg_id) => {
message_lists.current.select_id = (msg_id) => {
assert.equal(msg_id, message.id);
};
@ -218,7 +220,7 @@ test_ui("actions_popover", (override) => {
stream_id: 123,
};
current_msg_list.get = (msg_id) => {
message_lists.current.get = (msg_id) => {
assert.equal(msg_id, message.id);
return message;
};

View File

@ -44,9 +44,10 @@ const channel = mock_esm("../../static/js/channel");
const emoji_picker = mock_esm("../../static/js/emoji_picker", {
hide_emoji_popover() {},
});
const message_lists = mock_esm("../../static/js/message_lists");
const message_store = mock_esm("../../static/js/message_store");
set_global("current_msg_list", {
message_lists.current = {
selected_message() {
return {sent_by_me: true};
},
@ -56,7 +57,7 @@ set_global("current_msg_list", {
selected_id() {
return 42;
},
});
};
set_global("document", "document-stub");
page_params.user_id = alice_user_id;
@ -117,7 +118,7 @@ people.add_active_user(cali);
people.add_active_user(alexus);
run_test("open_reactions_popover (sent by me)", () => {
current_msg_list.selected_message = () => ({sent_by_me: true});
message_lists.current.selected_message = () => ({sent_by_me: true});
$(".selected-row").set_find_results(".actions_hover", ["action-stub"]);
let called = false;
@ -132,7 +133,7 @@ run_test("open_reactions_popover (sent by me)", () => {
});
run_test("open_reactions_popover (not sent by me)", () => {
current_msg_list.selected_message = () => ({sent_by_me: false});
message_lists.current.selected_message = () => ({sent_by_me: false});
$(".selected-row").set_find_results(".reaction_button", ["reaction-stub"]);
let called = false;

View File

@ -21,17 +21,18 @@ set_global("addEventListener", noop);
mock_cjs("jquery", $);
const channel = mock_esm("../../static/js/channel");
const message_lists = mock_esm("../../static/js/message_lists");
mock_esm("../../static/js/reload_state", {
is_in_progress() {
return false;
},
});
set_global("home_msg_list", {
message_lists.home = {
select_id: noop,
selected_id() {
return 1;
},
});
};
page_params.test_suite = false;
// we also directly write to pointer

View File

@ -2,7 +2,7 @@
const {strict: assert} = require("assert");
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
const {make_stub} = require("../zjsunit/stub");
const {run_test} = require("../zjsunit/test");
const blueslip = require("../zjsunit/zblueslip");
@ -27,13 +27,15 @@ mock_esm("../../static/js/message_list", {
},
},
});
const message_lists = mock_esm("../../static/js/message_lists", {
current: {},
});
mock_esm("../../static/js/recent_topics", {
complete_rerender: () => {},
});
mock_esm("../../static/js/settings_notifications", {
update_page: () => {},
});
set_global("current_msg_list", {});
mock_esm("../../static/js/overlays", {streams_open: () => true});
@ -280,7 +282,7 @@ test("marked_subscribed (normal)", (override) => {
override(stream_list, "add_sidebar_row", stream_list_stub.f);
override(message_util, "do_unread_count_updates", message_util_stub.f);
override(message_view_header, "render_title_area", message_view_header_stub.f);
override(current_msg_list, "update_trailing_bookend", () => {
override(message_lists.current, "update_trailing_bookend", () => {
list_updated = true;
});
@ -384,7 +386,7 @@ test("mark_unsubscribed (render_title_area)", (override) => {
override(message_view_header, "render_title_area", message_view_header_stub.f);
override(stream_data, "unsubscribe_myself", noop);
override(subs, "update_settings_for_unsubscribed", noop);
override(current_msg_list, "update_trailing_bookend", noop);
override(message_lists.current, "update_trailing_bookend", noop);
override(stream_list, "remove_sidebar_row", noop);
stream_events.mark_unsubscribed(sub);

View File

@ -4,19 +4,15 @@ const {strict: assert} = require("assert");
const _ = require("lodash");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {page_params} = require("../zjsunit/zpage_params");
page_params.realm_push_notifications_enabled = false;
const muting = zrequire("muting");
set_global("current_msg_list", {});
set_global("home_msg_list", {});
const {FoldDict} = zrequire("fold_dict");
const message_store = zrequire("message_store");
const muting = zrequire("muting");
const people = zrequire("people");
const stream_data = zrequire("stream_data");
const unread = zrequire("unread");

View File

@ -56,10 +56,10 @@ const fake_poll_widget = {
},
};
const message_lists = mock_esm("../../static/js/message_lists", {current: {}});
const narrow_state = mock_esm("../../static/js/narrow_state");
mock_esm("../../static/js/poll_widget", fake_poll_widget);
const current_msg_list = set_global("current_msg_list", {});
set_global("document", "document-stub");
const widgetize = zrequire("widgetize");
@ -184,11 +184,11 @@ test("activate", (override) => {
assert(!is_event_handled);
/* Test narrow change message update */
override(current_msg_list, "get", (idx) => {
override(message_lists.current, "get", (idx) => {
assert.equal(idx, 2001);
return {};
});
override(current_msg_list, "get_row", (idx) => {
override(message_lists.current, "get_row", (idx) => {
assert.equal(idx, 2001);
return row;
});

View File

@ -312,7 +312,7 @@ class CommonUtils {
- does it look to have been
re-rendered based on server info?
*/
const last_msg = current_msg_list.last();
const last_msg = zulip_test.current_msg_list.last();
if (last_msg === undefined) {
return false;
}

View File

@ -16,7 +16,6 @@ import "../reload";
import "../hotkey";
import "../notifications";
import "../server_events";
import "../zulip";
import "../templates";
import "../settings";
import "../ui_init";

View File

@ -22,6 +22,7 @@ import {i18n} from "./i18n";
import * as message_edit from "./message_edit";
import * as message_edit_history from "./message_edit_history";
import * as message_flags from "./message_flags";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as muting_ui from "./muting_ui";
import * as narrow from "./narrow";
@ -69,7 +70,7 @@ export function initialize() {
if (!id) {
return;
}
current_msg_list.select_id(id);
message_lists.current.select_id(id);
setTimeout(() => {
// The algorithm to trigger long tap is that first, we check
// whether the message is still touched after MS_DELAY ms and
@ -168,7 +169,7 @@ export function initialize() {
return;
}
current_msg_list.select_id(id);
message_lists.current.select_id(id);
compose_actions.respond_to_message({trigger: "message click"});
e.stopPropagation();
popovers.hide_all();
@ -230,8 +231,8 @@ export function initialize() {
$("body").on("click", ".message_edit_notice", (e) => {
popovers.hide_all();
const message_id = rows.id($(e.currentTarget).closest(".message_row"));
const row = current_msg_list.get_row(message_id);
const message = current_msg_list.get(rows.id(row));
const row = message_lists.current.get_row(message_id);
const message = message_lists.current.get(rows.id(row));
const message_history_cancel_btn = $("#message-history-cancel");
if (page_params.realm_allow_edit_history) {
@ -303,8 +304,8 @@ export function initialize() {
// MESSAGE EDITING
$("body").on("click", ".edit_content_button", function (e) {
const row = current_msg_list.get_row(rows.id($(this).closest(".message_row")));
current_msg_list.select_id(rows.id(row));
const row = message_lists.current.get_row(rows.id($(this).closest(".message_row")));
message_lists.current.select_id(rows.id(row));
message_edit.start(row);
e.stopPropagation();
popovers.hide_all();
@ -499,8 +500,8 @@ export function initialize() {
const group = rows.get_closest_group(narrow_link_elem);
const msg_id = rows.id_for_recipient_row(group);
const nearest = current_msg_list.get(msg_id);
const selected = current_msg_list.selected_message();
const nearest = message_lists.current.get(msg_id);
const selected = message_lists.current.selected_message();
if (util.same_recipient(nearest, selected)) {
return selected.id;
}

View File

@ -13,6 +13,7 @@ import * as compose_ui from "./compose_ui";
import * as drafts from "./drafts";
import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
@ -145,12 +146,12 @@ export function complete_starting_tasks(msg_type, opts) {
export function maybe_scroll_up_selected_message() {
// If the compose box is obscuring the currently selected message,
// scroll up until the message is no longer occluded.
if (current_msg_list.selected_id() === -1) {
if (message_lists.current.selected_id() === -1) {
// If there's no selected message, there's no need to
// scroll the compose box to avoid it.
return;
}
const selected_row = current_msg_list.selected_row();
const selected_row = message_lists.current.selected_row();
if (selected_row.height() > message_viewport.height() - 100) {
// For very tall messages whose height is close to the entire
@ -298,7 +299,7 @@ export function respond_to_message(opts) {
// in-progress composition, snapshot it.
drafts.update_draft();
const message = current_msg_list.selected_message();
const message = message_lists.current.selected_message();
if (message === undefined) {
// empty narrow implementation
@ -332,7 +333,7 @@ export function respond_to_message(opts) {
return;
}
if (current_msg_list.can_mark_messages_read()) {
if (message_lists.current.can_mark_messages_read()) {
unread_ops.notify_server_message_read(message);
}
@ -373,7 +374,7 @@ export function respond_to_message(opts) {
export function reply_with_mention(opts) {
respond_to_message(opts);
const message = current_msg_list.selected_message();
const message = message_lists.current.selected_message();
const mention = people.get_mention_syntax(message.sender_full_name, message.sender_id);
compose_ui.insert_syntax_and_focus(mention);
}
@ -425,8 +426,8 @@ export function on_topic_narrow() {
export function quote_and_reply(opts) {
const textarea = $("#compose-textarea");
const message_id = current_msg_list.selected_id();
const message = current_msg_list.selected_message();
const message_id = message_lists.current.selected_id();
const message = message_lists.current.selected_message();
if (compose_state.has_message_content()) {
// The user already started typing a message,

View File

@ -6,6 +6,7 @@ import * as compose_fade_helper from "./compose_fade_helper";
import * as compose_fade_users from "./compose_fade_users";
import * as compose_state from "./compose_state";
import * as floating_recipient_bar from "./floating_recipient_bar";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as people from "./people";
import * as rows from "./rows";
@ -45,7 +46,7 @@ export function set_focused_recipient(msg_type) {
}
function display_messages_normally() {
const table = rows.get_table(current_msg_list.table_name);
const table = rows.get_table(message_lists.current.table_name);
table.find(".recipient_row").removeClass("message-fade");
normal_display = true;
@ -72,7 +73,7 @@ function fade_messages() {
// Update the visible messages first, before the compose box opens
for (i = 0; i < visible_groups.length; i += 1) {
first_row = rows.first_message_in_group(visible_groups[i]);
first_message = current_msg_list.get(rows.id(first_row));
first_message = message_lists.current.get(rows.id(first_row));
should_fade_group = compose_fade_helper.should_fade_message(first_message);
change_fade_state($(visible_groups[i]), should_fade_group);
@ -81,10 +82,12 @@ function fade_messages() {
// Defer updating all message groups so that the compose box can open sooner
setTimeout(
(expected_msg_list, expected_recipient) => {
const all_groups = rows.get_table(current_msg_list.table_name).find(".recipient_row");
const all_groups = rows
.get_table(message_lists.current.table_name)
.find(".recipient_row");
if (
current_msg_list !== expected_msg_list ||
message_lists.current !== expected_msg_list ||
!compose_state.composing() ||
compose_state.private_message_recipient() !== expected_recipient
) {
@ -106,7 +109,7 @@ function fade_messages() {
floating_recipient_bar.update();
},
0,
current_msg_list,
message_lists.current,
compose_state.private_message_recipient(),
);
}

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import * as message_flags from "./message_flags";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as rows from "./rows";
@ -43,7 +44,7 @@ function uncondense_row(row) {
export function uncollapse(row) {
// Uncollapse a message, restoring the condensed message [More] or
// [Condense] link if necessary.
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
message.collapsed = false;
message_flags.save_uncollapsed(message);
@ -69,7 +70,7 @@ export function uncollapse(row) {
};
// We also need to collapse this message in the home view
const home_row = home_msg_list.get_row(rows.id(row));
const home_row = message_lists.home.get_row(rows.id(row));
process_row(row);
process_row(home_row);
@ -78,7 +79,7 @@ export function uncollapse(row) {
export function collapse(row) {
// Collapse a message, hiding the condensed message [More] or
// [Condense] link if necessary.
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
message.collapsed = true;
if (message.locally_echoed) {
@ -97,7 +98,7 @@ export function collapse(row) {
};
// We also need to collapse this message in the home view
const home_row = home_msg_list.get_row(rows.id(row));
const home_row = message_lists.home.get_row(rows.id(row));
process_row(row);
process_row(home_row);
@ -119,7 +120,7 @@ export function toggle_collapse(message) {
// * If the message is fully visible, either because it's too short to
// condense or because it's already uncondensed, collapse it
const row = current_msg_list.get_row(message.id);
const row = message_lists.current.get_row(message.id);
if (!row) {
return;
}
@ -208,7 +209,7 @@ export function condense_and_collapse(elems) {
continue;
}
const message = current_msg_list.get(message_id);
const message = message_lists.current.get(message_id);
if (message === undefined) {
continue;
}
@ -256,7 +257,7 @@ export function initialize() {
// Expanding a message can mean either uncollapsing or
// uncondensing it.
const row = $(this).closest(".message_row");
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
const content = row.find(".message_content");
if (message.collapsed) {
// Uncollapse.
@ -274,7 +275,7 @@ export function initialize() {
$("#message_feed_container").on("click", ".message_condenser", function (e) {
const row = $(this).closest(".message_row");
current_msg_list.get(rows.id(row)).condensed = true;
message_lists.current.get(rows.id(row)).condensed = true;
condense_row(row);
e.stopPropagation();
e.preventDefault();

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import TurndownService from "turndown/lib/turndown.cjs";
import * as compose_ui from "./compose_ui";
import * as message_lists from "./message_lists";
import {page_params} from "./page_params";
import * as rows from "./rows";
@ -83,7 +84,7 @@ function construct_copy_div(div, start_id, end_id) {
last_recipient_row_id = recipient_row_id;
should_include_start_recipient_header = true;
}
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
const message_firstp = $(message.content).slice(0, 1);
message_firstp.prepend(message.sender_full_name + ": ");
div.append(message_firstp);

View File

@ -7,6 +7,7 @@ import * as local_message from "./local_message";
import * as markdown from "./markdown";
import * as message_events from "./message_events";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as narrow_state from "./narrow_state";
import * as notifications from "./notifications";
@ -188,7 +189,7 @@ export function try_deliver_locally(message_request) {
return undefined;
}
if (!current_msg_list.data.fetch_status.has_found_newest()) {
if (!message_lists.current.data.fetch_status.has_found_newest()) {
// If the current message list doesn't yet have the latest
// messages before the one we just sent, local echo would make
// it appear as though there were no messages between what we
@ -282,8 +283,8 @@ export function edit_locally(message, request) {
// reaching this code path must either have been sent by us or the
// topic isn't being edited, so unread counts can't have changed.
home_msg_list.view.rerender_messages([message]);
if (current_msg_list === message_list.narrowed) {
message_lists.home.view.rerender_messages([message]);
if (message_lists.current === message_list.narrowed) {
message_list.narrowed.view.rerender_messages([message]);
}
stream_list.update_streams_sidebar();
@ -313,7 +314,7 @@ export function reify_message_id(local_id, server_id) {
}
export function update_message_lists({old_id, new_id}) {
for (const msg_list of [message_list.all, home_msg_list, message_list.narrowed]) {
for (const msg_list of [message_list.all, message_lists.home, message_list.narrowed]) {
if (msg_list !== undefined) {
msg_list.change_message_id(old_id, new_id);
@ -380,8 +381,8 @@ export function process_from_server(messages) {
// changes in either the rounded timestamp we display or the
// message content, but in practice, there's no harm to just
// doing it unconditionally.
home_msg_list.view.rerender_messages(msgs_to_rerender);
if (current_msg_list === message_list.narrowed) {
message_lists.home.view.rerender_messages(msgs_to_rerender);
if (message_lists.current === message_list.narrowed) {
message_list.narrowed.view.rerender_messages(msgs_to_rerender);
}
}
@ -402,7 +403,7 @@ export function message_send_error(message_id, error_response) {
function abort_message(message) {
// Remove in all lists in which it exists
for (const msg_list of [message_list.all, home_msg_list, current_msg_list]) {
for (const msg_list of [message_list.all, message_lists.home, message_lists.current]) {
msg_list.remove_and_rerender([message.id]);
}
}

View File

@ -11,6 +11,7 @@ import render_emoji_showcase from "../templates/emoji_showcase.hbs";
import * as blueslip from "./blueslip";
import * as compose_ui from "./compose_ui";
import {i18n} from "./i18n";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as popovers from "./popovers";
import * as reactions from "./reactions";
@ -253,7 +254,7 @@ function filter_emojis() {
}
function toggle_reaction(emoji_name, event) {
const message_id = current_msg_list.selected_id();
const message_id = message_lists.current.selected_id();
const message = message_store.get(message_id);
if (!message) {
blueslip.error("reactions: Bad message id: " + message_id);
@ -658,7 +659,7 @@ export function toggle_emoji_popover(element, id) {
$(element).closest(".message_row").toggleClass("has_popover has_emoji_popover");
const elt = $(element);
if (id !== undefined) {
current_msg_list.select_id(id);
message_lists.current.select_id(id);
}
if (elt.data("popover") === undefined) {

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import * as blueslip from "./blueslip";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as rows from "./rows";
import * as timerender from "./timerender";
@ -238,7 +239,7 @@ export function candidate_recipient_bar() {
// bars that is still above the fold.
// Start with the pointer's current location.
const selected_row = current_msg_list.selected_row();
const selected_row = message_lists.current.selected_row();
if (selected_row === undefined || selected_row.length === 0) {
return undefined;

View File

@ -3,8 +3,6 @@
// remove each declaration when the corresponding module is migrated
// to TS.
declare let current_msg_list: any;
declare let home_msg_list: any;
declare let zulip_test: any;
interface JQuery {

View File

@ -8,6 +8,7 @@ import * as floating_recipient_bar from "./floating_recipient_bar";
import * as hash_util from "./hash_util";
import * as info_overlay from "./info_overlay";
import * as invite from "./invite";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as narrow from "./narrow";
import * as navigate from "./navigate";
@ -126,7 +127,7 @@ function do_hashchange_normal(from_reload) {
if (from_reload) {
blueslip.debug("We are narrowing as part of a reload.");
if (page_params.initial_narrow_pointer !== undefined) {
home_msg_list.pre_narrow_offset = page_params.initial_offset;
message_lists.home.pre_narrow_offset = page_params.initial_offset;
narrow_opts.then_select_id = page_params.initial_narrow_pointer;
narrow_opts.then_select_offset = page_params.initial_narrow_offset;
}

View File

@ -20,6 +20,7 @@ import * as lightbox from "./lightbox";
import * as list_util from "./list_util";
import * as message_edit from "./message_edit";
import * as message_flags from "./message_flags";
import * as message_lists from "./message_lists";
import * as message_view_header from "./message_view_header";
import * as muting_ui from "./muting_ui";
import * as narrow from "./narrow";
@ -37,7 +38,7 @@ import * as topic_zoom from "./topic_zoom";
import * as ui from "./ui";
function do_narrow_action(action) {
action(current_msg_list.selected_id(), {trigger: "hotkey"});
action(message_lists.current.selected_id(), {trigger: "hotkey"});
return true;
}
@ -792,7 +793,7 @@ export function process_hotkey(e, hotkey) {
return true;
}
if (current_msg_list.empty()) {
if (message_lists.current.empty()) {
return false;
}
@ -825,7 +826,7 @@ export function process_hotkey(e, hotkey) {
return true;
}
const msg = current_msg_list.selected_message();
const msg = message_lists.current.selected_message();
// Shortcuts that operate on a message
switch (event_name) {
case "message_actions":
@ -870,7 +871,7 @@ export function process_hotkey(e, hotkey) {
compose_actions.quote_and_reply({trigger: "hotkey"});
return true;
case "edit_message": {
const row = current_msg_list.get_row(msg.id);
const row = message_lists.current.get_row(msg.id);
message_edit.start(row);
return true;
}

View File

@ -14,6 +14,7 @@ import * as echo from "./echo";
import {i18n} from "./i18n";
import * as loading from "./loading";
import * as markdown from "./markdown";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as message_viewport from "./message_viewport";
import {page_params} from "./page_params";
@ -300,7 +301,7 @@ function edit_message(row, raw_content) {
condense.hide_message_condenser(row);
const content_top = row.find(".message_top_line")[0].getBoundingClientRect().top;
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
// We potentially got to this function by clicking a button that implied the
// user would be able to edit their message. Give a little bit of buffer in
@ -352,7 +353,7 @@ function edit_message(row, raw_content) {
const edit_obj = {form, raw_content};
currently_editing_messages.set(message.id, edit_obj);
current_msg_list.show_edit_message(row, edit_obj);
message_lists.current.show_edit_message(row, edit_obj);
form.on("keydown", handle_message_row_edit_keydown);
@ -532,7 +533,7 @@ function start_edit_with_content(row, content, edit_box_open_callback) {
}
export function start(row, edit_box_open_callback) {
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
if (message === undefined) {
blueslip.error("Couldn't find message ID for edit " + rows.id(row));
return;
@ -543,12 +544,12 @@ export function start(row, edit_box_open_callback) {
return;
}
const msg_list = current_msg_list;
const msg_list = message_lists.current;
channel.get({
url: "/json/messages/" + message.id,
idempotent: true,
success(data) {
if (current_msg_list === msg_list) {
if (message_lists.current === msg_list) {
message.raw_content = data.raw_content;
start_edit_with_content(row, message.raw_content, edit_box_open_callback);
}
@ -558,11 +559,11 @@ export function start(row, edit_box_open_callback) {
export function start_inline_topic_edit(recipient_row) {
const form = $(render_topic_edit_form());
current_msg_list.show_edit_topic_on_recipient_row(recipient_row, form);
message_lists.current.show_edit_topic_on_recipient_row(recipient_row, form);
form.on("keydown", handle_inline_topic_edit_keydown);
$(".topic_edit_spinner").hide();
const msg_id = rows.id_for_recipient_row(recipient_row);
const message = current_msg_list.get(msg_id);
const message = message_lists.current.get(msg_id);
let topic = message.topic;
if (topic === compose.empty_topic_placeholder()) {
topic = "";
@ -575,11 +576,11 @@ export function is_editing(id) {
}
export function end_inline_topic_edit(row) {
current_msg_list.hide_edit_topic_on_recipient_row(row);
message_lists.current.hide_edit_topic_on_recipient_row(row);
}
export function end_message_row_edit(row) {
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
if (message !== undefined && currently_editing_messages.has(message.id)) {
const scroll_by = currently_editing_messages.get(message.id).scrolled_by;
message_viewport.scrollTop(message_viewport.scrollTop() - scroll_by);
@ -594,7 +595,7 @@ export function end_message_row_edit(row) {
}
currently_editing_messages.delete(message.id);
current_msg_list.hide_edit_message(row);
message_lists.current.hide_edit_message(row);
compose.abort_video_callbacks(message.id);
}
@ -611,9 +612,9 @@ export function end_message_row_edit(row) {
}
export function save_inline_topic_edit(row) {
const msg_list = current_msg_list;
const msg_list = message_lists.current;
let message_id = rows.id_for_recipient_row(row);
const message = current_msg_list.get(message_id);
const message = message_lists.current.get(message_id);
const old_topic = message.topic;
const new_topic = row.find(".inline_topic_edit").val();
@ -631,7 +632,7 @@ export function save_inline_topic_edit(row) {
if (message.locally_echoed) {
if (topic_changed) {
echo.edit_locally(message, {new_topic});
row = current_msg_list.get_row(message_id);
row = message_lists.current.get_row(message_id);
}
end_inline_topic_edit(row);
return;
@ -653,7 +654,7 @@ export function save_inline_topic_edit(row) {
error(xhr) {
const spinner = row.find(".topic_edit_spinner");
loading.destroy_indicator(spinner);
if (msg_list === current_msg_list) {
if (msg_list === message_lists.current) {
message_id = rows.id_for_recipient_row(row);
const message = channel.xhr_error_message(i18n.t("Error saving edit"), xhr);
row.find(".edit_error").text(message).css("display", "inline-block");
@ -663,9 +664,9 @@ export function save_inline_topic_edit(row) {
}
export function save_message_row_edit(row) {
const msg_list = current_msg_list;
const msg_list = message_lists.current;
let message_id = rows.id(row);
const message = current_msg_list.get(message_id);
const message = message_lists.current.get(message_id);
let changed = false;
let edit_locally_echoed = false;
@ -697,7 +698,7 @@ export function save_message_row_edit(row) {
new_topic,
new_stream_id,
});
row = current_msg_list.get_row(message_id);
row = message_lists.current.get_row(message_id);
}
end_message_row_edit(row);
return;
@ -776,7 +777,7 @@ export function save_message_row_edit(row) {
echo.edit_locally(message, currently_echoing_messages.get(message_id));
row = current_msg_list.get_row(message_id);
row = message_lists.current.get_row(message_id);
end_message_row_edit(row);
}
@ -791,7 +792,7 @@ export function save_message_row_edit(row) {
hide_message_edit_spinner(row);
},
error(xhr) {
if (msg_list === current_msg_list) {
if (msg_list === message_lists.current) {
message_id = rows.id(row);
if (edit_locally_echoed) {
@ -810,7 +811,7 @@ export function save_message_row_edit(row) {
alerted: echo_data.alerted,
});
row = current_msg_list.get_row(message_id);
row = message_lists.current.get_row(message_id);
if (!is_editing(message_id)) {
// Return to the message editing open UI state.
start_edit_maintaining_scroll(row, echo_data.orig_raw_content);
@ -828,12 +829,12 @@ export function save_message_row_edit(row) {
export function maybe_show_edit(row, id) {
if (currently_editing_messages.has(id)) {
current_msg_list.show_edit_message(row, currently_editing_messages.get(id));
message_lists.current.show_edit_message(row, currently_editing_messages.get(id));
}
}
export function edit_last_sent_message() {
const msg = current_msg_list.get_last_message_sent_by_me();
const msg = message_lists.current.get_last_message_sent_by_me();
if (!msg) {
return;
@ -849,15 +850,15 @@ export function edit_last_sent_message() {
return;
}
const msg_row = current_msg_list.get_row(msg.id);
const msg_row = message_lists.current.get_row(msg.id);
if (!msg_row) {
// This should never happen, since we got the message above
// from current_msg_list.
// from message_lists.current.
blueslip.error("Could not find row for id " + msg.id);
return;
}
current_msg_list.select_id(msg.id, {then_scroll: true, from_scroll: true});
message_lists.current.select_id(msg.id, {then_scroll: true, from_scroll: true});
// Finally do the real work!
compose_actions.cancel();
@ -932,9 +933,9 @@ export function delete_topic(stream_id, topic_name) {
export function handle_narrow_deactivated() {
for (const [idx, elem] of currently_editing_messages) {
if (current_msg_list.get(idx) !== undefined) {
const row = current_msg_list.get_row(idx);
current_msg_list.show_edit_message(row, elem);
if (message_lists.current.get(idx) !== undefined) {
const row = message_lists.current.get_row(idx);
message_lists.current.show_edit_message(row, elem);
}
}
}

View File

@ -10,6 +10,7 @@ import * as message_edit from "./message_edit";
import * as message_edit_history from "./message_edit_history";
import * as message_helper from "./message_helper";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as message_util from "./message_util";
import * as narrow from "./narrow";
@ -43,7 +44,7 @@ function maybe_add_narrowed_messages(messages, msg_list) {
},
timeout: 5000,
success(data) {
if (msg_list !== current_msg_list) {
if (msg_list !== message_lists.current) {
// We unnarrowed in the mean time
return;
}
@ -77,7 +78,7 @@ function maybe_add_narrowed_messages(messages, msg_list) {
error() {
// We might want to be more clever here
setTimeout(() => {
if (msg_list === current_msg_list) {
if (msg_list === message_lists.current) {
// Don't actually try again if we unnarrowed
// while waiting
maybe_add_narrowed_messages(messages, msg_list);
@ -102,7 +103,7 @@ export function insert_new_messages(messages, sent_by_this_client) {
if (narrow_state.active()) {
// We do this NOW even though the home view is not active,
// because we want the home view to load fast later.
message_util.add_new_messages(messages, home_msg_list);
message_util.add_new_messages(messages, message_lists.home);
if (narrow_state.filter().can_apply_locally()) {
render_info = message_util.add_new_messages(messages, message_list.narrowed);
@ -112,7 +113,7 @@ export function insert_new_messages(messages, sent_by_this_client) {
}
} else {
// we're in the home view, so update its list
render_info = message_util.add_new_messages(messages, home_msg_list);
render_info = message_util.add_new_messages(messages, message_lists.home);
}
if (sent_by_this_client) {
@ -165,7 +166,7 @@ export function update_messages(events) {
msg.is_me_message = event.is_me_message;
}
const row = current_msg_list.get_row(event.message_id);
const row = message_lists.current.get_row(event.message_id);
if (row.length > 0) {
message_edit.end_message_row_edit(row);
}
@ -189,7 +190,7 @@ export function update_messages(events) {
const orig_topic = util.get_edit_event_orig_topic(event);
const current_filter = narrow_state.filter();
const current_selected_id = current_msg_list.selected_id();
const current_selected_id = message_lists.current.selected_id();
const selection_changed_topic = event.message_ids.includes(current_selected_id);
const event_messages = event.message_ids.map((id) => message_store.get(id));
// The event.message_ids received from the server are not in sorted order.
@ -331,8 +332,8 @@ export function update_messages(events) {
// list and then pass these to the remove messages codepath.
// While we can pass all our messages to the add messages
// codepath as the filtering is done within the method.
current_msg_list.remove_and_rerender(message_ids_to_remove);
current_msg_list.add_messages(event_messages);
message_lists.current.remove_and_rerender(message_ids_to_remove);
message_lists.current.add_messages(event_messages);
}
}
@ -395,17 +396,17 @@ export function update_messages(events) {
// propagated edits to be updated (since the topic edits can have
// changed the correct grouping of messages).
if (topic_edited || stream_changed) {
home_msg_list.update_muting_and_rerender();
message_lists.home.update_muting_and_rerender();
// However, we don't need to rerender message_list.narrowed if
// we just changed the narrow earlier in this function.
if (!changed_narrow && current_msg_list === message_list.narrowed) {
if (!changed_narrow && message_lists.current === message_list.narrowed) {
message_list.narrowed.update_muting_and_rerender();
}
} else {
// If the content of the message was edited, we do a special animation.
current_msg_list.view.rerender_messages(msgs_to_rerender, message_content_edited);
if (current_msg_list === message_list.narrowed) {
home_msg_list.view.rerender_messages(msgs_to_rerender);
message_lists.current.view.rerender_messages(msgs_to_rerender, message_content_edited);
if (message_lists.current === message_list.narrowed) {
message_lists.home.view.rerender_messages(msgs_to_rerender);
}
}
@ -421,7 +422,7 @@ export function update_messages(events) {
}
export function remove_messages(message_ids) {
for (const list of [message_list.all, home_msg_list, message_list.narrowed]) {
for (const list of [message_list.all, message_lists.home, message_list.narrowed]) {
if (list === undefined) {
continue;
}

View File

@ -5,6 +5,7 @@ import {Filter} from "./filter";
import * as huddle_data from "./huddle_data";
import * as message_helper from "./message_helper";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as message_store from "./message_store";
import * as message_util from "./message_util";
@ -40,7 +41,7 @@ function process_result(data, opts) {
if (
messages.length === 0 &&
current_msg_list === message_list.narrowed &&
message_lists.current === message_list.narrowed &&
message_list.narrowed.empty()
) {
// Even after trying to load more messages, we have no
@ -61,9 +62,9 @@ function process_result(data, opts) {
message_util.do_unread_count_updates(messages);
// If we're loading more messages into the home view, save them to
// the message_list.all as well, as the home_msg_list is reconstructed
// the message_list.all as well, as the message_lists.home is reconstructed
// from message_list.all.
if (opts.msg_list === home_msg_list) {
if (opts.msg_list === message_lists.home) {
message_util.add_old_messages(messages, message_list.all);
}
@ -84,15 +85,15 @@ function process_result(data, opts) {
}
function get_messages_success(data, opts) {
const update_loading_indicator = opts.msg_list === current_msg_list;
const update_loading_indicator = opts.msg_list === message_lists.current;
if (opts.num_before > 0) {
opts.msg_list.data.fetch_status.finish_older_batch({
update_loading_indicator,
found_oldest: data.found_oldest,
history_limited: data.history_limited,
});
if (opts.msg_list === home_msg_list) {
// When we update home_msg_list, we need to also update
if (opts.msg_list === message_lists.home) {
// When we update message_lists.home, we need to also update
// the fetch_status data structure for message_list.all,
// which is never rendered (and just used for
// prepopulating narrowed views).
@ -110,8 +111,8 @@ function get_messages_success(data, opts) {
update_loading_indicator,
found_newest: data.found_newest,
});
if (opts.msg_list === home_msg_list) {
// When we update home_msg_list, we need to also update
if (opts.msg_list === message_lists.home) {
// When we update message_lists.home, we need to also update
// the fetch_status data structure for message_list.all,
// which is never rendered (and just used for
// prepopulating narrowed views).
@ -125,7 +126,7 @@ function get_messages_success(data, opts) {
}
}
if (opts.msg_list.narrowed && opts.msg_list !== current_msg_list) {
if (opts.msg_list.narrowed && opts.msg_list !== message_lists.current) {
// We unnarrowed before receiving new messages so
// don't bother processing the newly arrived messages.
return;
@ -198,16 +199,16 @@ export function load_messages(opts) {
// data.narrow = opts.msg_list.data.filter.public_operators()
//
// But support for the message_list.all sharing of data with
// home_msg_list and the (hacky) page_params.narrow feature
// message_lists.home and the (hacky) page_params.narrow feature
// requires a somewhat ugly bundle of conditionals.
if (opts.msg_list === home_msg_list) {
if (opts.msg_list === message_lists.home) {
if (page_params.narrow_stream !== undefined) {
data.narrow = JSON.stringify(page_params.narrow);
}
// Otherwise, we don't pass narrow for home_msg_list; this is
// Otherwise, we don't pass narrow for message_lists.home; this is
// required because it shares its data with all_msg_list, and
// so we need the server to send us message history from muted
// streams and topics even though home_msg_list's in:home
// streams and topics even though message_lists.home's in:home
// operators will filter those.
} else {
let operators = opts.msg_list.data.filter.public_operators();
@ -217,12 +218,12 @@ export function load_messages(opts) {
data.narrow = JSON.stringify(operators);
}
let update_loading_indicator = opts.msg_list === current_msg_list;
let update_loading_indicator = opts.msg_list === message_lists.current;
if (opts.num_before > 0) {
opts.msg_list.data.fetch_status.start_older_batch({
update_loading_indicator,
});
if (opts.msg_list === home_msg_list) {
if (opts.msg_list === message_lists.home) {
message_list.all.data.fetch_status.start_older_batch({
update_loading_indicator,
});
@ -235,7 +236,7 @@ export function load_messages(opts) {
opts.msg_list.data.fetch_status.start_newer_batch({
update_loading_indicator,
});
if (opts.msg_list === home_msg_list) {
if (opts.msg_list === message_lists.home) {
message_list.all.data.fetch_status.start_newer_batch({
update_loading_indicator,
});
@ -253,7 +254,7 @@ export function load_messages(opts) {
get_messages_success(data, opts);
},
error(xhr) {
if (opts.msg_list.narrowed && opts.msg_list !== current_msg_list) {
if (opts.msg_list.narrowed && opts.msg_list !== message_lists.current) {
// We unnarrowed before getting an error so don't
// bother trying again or doing further processing.
return;
@ -294,7 +295,7 @@ export function load_messages_for_narrow(opts) {
}
export function get_backfill_anchor(msg_list) {
if (msg_list === home_msg_list) {
if (msg_list === message_lists.home) {
msg_list = message_list.all;
}
@ -309,7 +310,7 @@ export function get_backfill_anchor(msg_list) {
}
export function get_frontfill_anchor(msg_list) {
if (msg_list === home_msg_list) {
if (msg_list === message_lists.home) {
msg_list = message_list.all;
}
@ -376,8 +377,8 @@ export function maybe_load_newer_messages(opts) {
const anchor = get_frontfill_anchor(msg_list);
function load_more(data, args) {
if (args.fetch_again && args.msg_list === current_msg_list) {
maybe_load_newer_messages({msg_list: current_msg_list});
if (args.fetch_again && args.msg_list === message_lists.current) {
maybe_load_newer_messages({msg_list: message_lists.current});
}
}
@ -397,7 +398,7 @@ export function start_backfilling_messages() {
onIdle() {
do_backfill({
num_before: consts.backfill_batch_size,
msg_list: home_msg_list,
msg_list: message_lists.home,
});
},
});
@ -408,11 +409,11 @@ export function initialize(home_view_loaded) {
function load_more(data) {
// If we haven't selected a message in the home view yet, and
// the home view isn't empty, we select the anchor message here.
if (home_msg_list.selected_id() === -1 && !home_msg_list.empty()) {
if (message_lists.home.selected_id() === -1 && !message_lists.home.empty()) {
// We fall back to the closest selected id, as the user
// may have removed a stream from the home view while we
// were loading data.
home_msg_list.select_id(data.anchor, {
message_lists.home.select_id(data.anchor, {
then_scroll: true,
use_closest: true,
target_scroll_offset: page_params.initial_offset,
@ -435,7 +436,7 @@ export function initialize(home_view_loaded) {
anchor: latest_id,
num_before: 0,
num_after: consts.catch_up_batch_size,
msg_list: home_msg_list,
msg_list: message_lists.home,
cont: load_more,
});
}
@ -454,7 +455,7 @@ export function initialize(home_view_loaded) {
anchor,
num_before: consts.num_before_home_anchor,
num_after: consts.num_after_home_anchor,
msg_list: home_msg_list,
msg_list: message_lists.home,
cont: load_more,
});

View File

@ -16,6 +16,7 @@ import * as condense from "./condense";
import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as message_viewport from "./message_viewport";
import * as narrow_state from "./narrow_state";
@ -326,11 +327,11 @@ export class MessageListView {
message_container.subscribed = false;
message_container.unsubscribed = false;
// This home_msg_list condition can be removed
// This message_lists.home condition can be removed
// once we filter historical messages from the
// home view on the server side (which requires
// having an index on UserMessage.flags)
if (this.list !== home_msg_list) {
if (this.list !== message_lists.home) {
this.add_subscription_marker(current_group, prev, message_container);
}
@ -412,7 +413,7 @@ export class MessageListView {
return true;
// Add a subscription marker
} else if (
this.list !== home_msg_list &&
this.list !== message_lists.home &&
last_msg_container.msg.historical !== first_msg_container.msg.historical
) {
second_group.bookend_top = true;
@ -631,7 +632,7 @@ export class MessageListView {
const restore_scroll_position = () => {
if (
!recent_topics.is_visible() &&
list === current_msg_list &&
list === message_lists.current &&
orig_scrolltop_offset !== undefined
) {
list.view.set_message_offset(orig_scrolltop_offset);
@ -789,7 +790,7 @@ export class MessageListView {
}
}
if (list === current_msg_list) {
if (list === message_lists.current) {
// Update the fade.
const get_element = (message_group) => {
@ -804,7 +805,7 @@ export class MessageListView {
compose_fade.update_rendered_message_groups(new_message_groups, get_element);
}
if (list === current_msg_list && messages_are_new) {
if (list === message_lists.current && messages_are_new) {
// First, in single-recipient narrows, potentially
// auto-scroll to the latest message if it was sent by us.
if (narrow_state.narrowed_by_reply()) {

View File

@ -0,0 +1,18 @@
import {Filter} from "./filter";
import * as message_list from "./message_list";
export let home;
export let current;
export function set_current(msg_list) {
current = msg_list;
}
export function initialize() {
home = new message_list.MessageList({
table_name: "zhome",
filter: new Filter([{operator: "in", operand: "home"}]),
excludes_muted_topics: true,
});
current = home;
}

View File

@ -1,9 +1,10 @@
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as people from "./people";
function rerender_messages_view() {
for (const list of [home_msg_list, message_list.narrowed, message_list.all]) {
for (const list of [message_lists.home, message_list.narrowed, message_list.all]) {
if (list === undefined) {
continue;
}

View File

@ -5,6 +5,7 @@ import * as floating_recipient_bar from "./floating_recipient_bar";
import * as hash_util from "./hash_util";
import * as loading from "./loading";
import * as message_fetch from "./message_fetch";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as narrow_banner from "./narrow_banner";
import * as narrow_state from "./narrow_state";
@ -90,11 +91,14 @@ export function show_end_of_results_notice() {
export function update_top_of_narrow_notices(msg_list) {
// Assumes that the current state is all notices hidden (i.e. this
// will not hide a notice that should not be there)
if (msg_list !== current_msg_list) {
if (msg_list !== message_lists.current) {
return;
}
if (msg_list.data.fetch_status.has_found_oldest() && current_msg_list !== home_msg_list) {
if (
msg_list.data.fetch_status.has_found_oldest() &&
message_lists.current !== message_lists.home
) {
const filter = narrow_state.filter();
if (filter === undefined && recent_topics.is_visible()) {
// user moved away from the narrow / filter to recent topics.
@ -146,13 +150,13 @@ export function scroll_finished() {
if (message_viewport.at_top()) {
message_fetch.maybe_load_older_messages({
msg_list: current_msg_list,
msg_list: message_lists.current,
});
}
if (message_viewport.at_bottom()) {
message_fetch.maybe_load_newer_messages({
msg_list: current_msg_list,
msg_list: message_lists.current,
});
}

View File

@ -2,6 +2,7 @@ import $ from "jquery";
import * as blueslip from "./blueslip";
import {media_breakpoints} from "./css_variables";
import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as rows from "./rows";
import * as util from "./util";
@ -237,7 +238,7 @@ function _visible_divs(
}
export function visible_groups(require_fully_visible) {
const selected_row = current_msg_list.selected_row();
const selected_row = message_lists.current.selected_row();
if (selected_row === undefined || selected_row.length === 0) {
return [];
}
@ -253,10 +254,10 @@ export function visible_groups(require_fully_visible) {
}
export function visible_messages(require_fully_visible) {
const selected_row = current_msg_list.selected_row();
const selected_row = message_lists.current.selected_row();
function row_to_id(row) {
return current_msg_list.get(rows.id($(row)));
return message_lists.current.get(rows.id($(row)));
}
// Being simplistic about this, the smallest message is 25 px high.
@ -387,7 +388,7 @@ export function keep_pointer_in_view() {
// users will occasionally do big mouse scrolls, so this gives them
// a pointer reasonably close to the middle of the screen.
let candidate;
let next_row = current_msg_list.selected_row();
let next_row = message_lists.current.selected_row();
if (next_row.length === 0) {
return;
@ -446,7 +447,7 @@ export function keep_pointer_in_view() {
adjust(message_is_far_enough_up, rows.prev_visible);
}
current_msg_list.select_id(rows.id(next_row), {from_scroll: true});
message_lists.current.select_id(rows.id(next_row), {from_scroll: true});
}
export function initialize() {

View File

@ -7,6 +7,7 @@ import * as channel from "./channel";
import * as feedback_widget from "./feedback_widget";
import {i18n} from "./i18n";
import * as ListWidget from "./list_widget";
import * as message_lists from "./message_lists";
import * as muting from "./muting";
import * as overlays from "./overlays";
import * as recent_topics from "./recent_topics";
@ -30,11 +31,11 @@ export function rerender_on_topic_update() {
// re-doing a mute or unmute is a pretty recoverable thing.
stream_list.update_streams_sidebar();
if (current_msg_list.excludes_muted_topics) {
current_msg_list.update_muting_and_rerender();
if (message_lists.current.excludes_muted_topics) {
message_lists.current.update_muting_and_rerender();
}
if (current_msg_list !== home_msg_list) {
home_msg_list.update_muting_and_rerender();
if (message_lists.current !== message_lists.home) {
message_lists.home.update_muting_and_rerender();
}
if (overlays.settings_open() && settings_muting.loaded) {
set_up_muted_topics_ui();

View File

@ -13,6 +13,7 @@ import * as message_edit from "./message_edit";
import * as message_fetch from "./message_fetch";
import * as message_list from "./message_list";
import {MessageListData} from "./message_list_data";
import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as message_store from "./message_store";
import * as message_view_header from "./message_view_header";
@ -93,19 +94,19 @@ function report_unnarrow_time() {
}
export function save_pre_narrow_offset_for_reload() {
if (current_msg_list.selected_id() !== -1) {
if (current_msg_list.selected_row().length === 0) {
if (message_lists.current.selected_id() !== -1) {
if (message_lists.current.selected_row().length === 0) {
blueslip.debug("narrow.activate missing selected row", {
selected_id: current_msg_list.selected_id(),
selected_idx: current_msg_list.selected_idx(),
selected_idx_exact: current_msg_list
selected_id: message_lists.current.selected_id(),
selected_idx: message_lists.current.selected_idx(),
selected_idx_exact: message_lists.current
.all_messages()
.indexOf(current_msg_list.get(current_msg_list.selected_id())),
render_start: current_msg_list.view._render_win_start,
render_end: current_msg_list.view._render_win_end,
.indexOf(message_lists.current.get(message_lists.current.selected_id())),
render_start: message_lists.current.view._render_win_start,
render_end: message_lists.current.view._render_win_end,
});
}
current_msg_list.pre_narrow_offset = current_msg_list.selected_row().offset().top;
message_lists.current.pre_narrow_offset = message_lists.current.selected_row().offset().top;
}
}
@ -152,7 +153,7 @@ function update_narrow_title(filter) {
export function activate(raw_operators, opts) {
/* Main entrypoint for switching to a new view / message list.
Note that for historical reasons related to the current
client-side caching structure, the "All messages"/home_msg_list
client-side caching structure, the "All messages"/message_lists.home
view is reached via `narrow.deactivate()`.
The name is based on "narrowing to a subset of the user's
@ -160,7 +161,7 @@ export function activate(raw_operators, opts) {
raw_operators: Narrowing/search operators; used to construct
a Filter object that decides which messages belong in the
view. Required (See the above note on how `home_msg_list` works)
view. Required (See the above note on how `message_lists.home` works)
All other options are encoded via the `opts` dictionary:
@ -213,7 +214,7 @@ export function activate(raw_operators, opts) {
blueslip.debug("Narrowed", {
operators: operators.map((e) => e.operator),
trigger: opts ? opts.trigger : undefined,
previous_id: current_msg_list.selected_id(),
previous_id: message_lists.current.selected_id(),
});
opts = {
@ -244,7 +245,7 @@ export function activate(raw_operators, opts) {
// having a near: narrow auto-reloaded.
id_info.target_id = opts.then_select_id;
if (opts.then_select_offset === undefined) {
const row = current_msg_list.get_row(opts.then_select_id);
const row = message_lists.current.get_row(opts.then_select_id);
if (row.length > 0) {
opts.then_select_offset = row.offset().top;
}
@ -301,8 +302,8 @@ export function activate(raw_operators, opts) {
msg_list.start_time = start_time;
// Show the new set of messages. It is important to set current_msg_list to
// the view right as it's being shown, because we rely on current_msg_list
// Show the new set of messages. It is important to set message_lists.current to
// the view right as it's being shown, because we rely on message_lists.current
// being shown for deciding when to condense messages.
$("body").addClass("narrowed_view");
$("#zfilt").addClass("focused_table");
@ -310,7 +311,7 @@ export function activate(raw_operators, opts) {
ui_util.change_tab_to("#message_feed_container");
message_list.set_narrowed(msg_list);
current_msg_list = message_list.narrowed;
message_lists.set_current(message_list.narrowed);
let then_select_offset;
if (id_info.target_id === id_info.final_select_id) {
@ -701,7 +702,7 @@ export function by(operator, operand, opts) {
}
export function by_topic(target_id, opts) {
// don't use current_msg_list as it won't work for muted messages or for out-of-narrow links
// don't use message_lists.current as it won't work for muted messages or for out-of-narrow links
const original = message_store.get(target_id);
if (original.type !== "stream") {
// Only stream messages have topics, but the
@ -726,7 +727,7 @@ export function by_topic(target_id, opts) {
// Called for the 'narrow by stream' hotkey.
export function by_recipient(target_id, opts) {
opts = {then_select_id: target_id, ...opts};
// don't use current_msg_list as it won't work for muted messages or for out-of-narrow links
// don't use message_lists.current as it won't work for muted messages or for out-of-narrow links
const message = message_store.get(target_id);
// We don't check msg_list.can_mark_messages_read here only because
@ -805,7 +806,7 @@ function handle_post_narrow_deactivate_processes() {
narrow_title = "All messages";
notifications.redraw_title();
message_scroll.hide_top_of_narrow_notices();
message_scroll.update_top_of_narrow_notices(home_msg_list);
message_scroll.update_top_of_narrow_notices(message_lists.home);
}
export function deactivate(coming_from_recent_topics = false) {
@ -813,16 +814,16 @@ export function deactivate(coming_from_recent_topics = false) {
// always use browser_history.go_to_location("#all_messages") to
// activate All message narrow.
/*
Switches current_msg_list from narrowed_msg_list to
home_msg_list ("All messages"), ending the current narrow. This
is a very fast operation, because we keep home_msg_list's data
Switches message_lists.current from narrowed_msg_list to
message_lists.home ("All messages"), ending the current narrow. This
is a very fast operation, because we keep message_lists.home's data
cached and updated in the DOM at all times, making it suitable
for rapid access via keyboard shortcuts.
Long-term, we will likely want to make `home_msg_list` not
Long-term, we will likely want to make `message_lists.home` not
special in any way, and instead just have a generic
message_list_data structure caching system that happens to have
home_msg_list in it.
message_lists.home in it.
*/
search.clear_search_form();
// Both All messages and Recent Topics have `undefined` filter.
@ -852,16 +853,16 @@ export function deactivate(coming_from_recent_topics = false) {
$("body").removeClass("narrowed_view");
$("#zfilt").removeClass("focused_table");
$("#zhome").addClass("focused_table");
current_msg_list = home_msg_list;
message_lists.set_current(message_lists.home);
condense.condense_and_collapse($("#zhome div.message_row"));
message_scroll.hide_indicators();
hashchange.save_narrow();
if (current_msg_list.selected_id() !== -1) {
if (message_lists.current.selected_id() !== -1) {
const preserve_pre_narrowing_screen_position =
current_msg_list.selected_row().length > 0 &&
current_msg_list.pre_narrow_offset !== undefined;
message_lists.current.selected_row().length > 0 &&
message_lists.current.pre_narrow_offset !== undefined;
let message_id_to_select;
const select_opts = {
then_scroll: true,
@ -878,7 +879,7 @@ export function deactivate(coming_from_recent_topics = false) {
// We read some unread messages in a narrow. Instead of going back to
// where we were before the narrow, go to our first unread message (or
// the bottom of the feed, if there are no unread messages).
message_id_to_select = current_msg_list.first_unread_message_id();
message_id_to_select = message_lists.current.first_unread_message_id();
} else {
// We narrowed, but only backwards in time (ie no unread were read). Try
// to go back to exactly where we were before narrowing.
@ -886,11 +887,11 @@ export function deactivate(coming_from_recent_topics = false) {
// We scroll the user back to exactly the offset from the selected
// message that they were at the time that they narrowed.
// TODO: Make this correctly handle the case of resizing while narrowed.
select_opts.target_scroll_offset = current_msg_list.pre_narrow_offset;
select_opts.target_scroll_offset = message_lists.current.pre_narrow_offset;
}
message_id_to_select = current_msg_list.selected_id();
message_id_to_select = message_lists.current.selected_id();
}
current_msg_list.select_id(message_id_to_select, select_opts);
message_lists.current.select_id(message_id_to_select, select_opts);
}
handle_post_narrow_deactivate_processes();

View File

@ -1,14 +1,15 @@
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as rows from "./rows";
import * as unread_ops from "./unread_ops";
function go_to_row(msg_id) {
current_msg_list.select_id(msg_id, {then_scroll: true, from_scroll: true});
message_lists.current.select_id(msg_id, {then_scroll: true, from_scroll: true});
}
export function up() {
message_viewport.set_last_movement_direction(-1);
const msg_id = current_msg_list.prev();
const msg_id = message_lists.current.prev();
if (msg_id === undefined) {
return;
}
@ -18,15 +19,15 @@ export function up() {
export function down(with_centering) {
message_viewport.set_last_movement_direction(1);
if (current_msg_list.is_at_end()) {
if (message_lists.current.is_at_end()) {
if (with_centering) {
// At the last message, scroll to the bottom so we have
// lots of nice whitespace for new messages coming in.
const current_msg_table = rows.get_table(current_msg_list.table_name);
const current_msg_table = rows.get_table(message_lists.current.table_name);
message_viewport.scrollTop(
current_msg_table.safeOuterHeight(true) - message_viewport.height() * 0.1,
);
if (current_msg_list.can_mark_messages_read()) {
if (message_lists.current.can_mark_messages_read()) {
unread_ops.mark_current_list_as_read();
}
}
@ -35,7 +36,7 @@ export function down(with_centering) {
}
// Normal path starts here.
const msg_id = current_msg_list.next();
const msg_id = message_lists.current.next();
if (msg_id === undefined) {
return;
}
@ -44,15 +45,15 @@ export function down(with_centering) {
export function to_home() {
message_viewport.set_last_movement_direction(-1);
const first_id = current_msg_list.first().id;
current_msg_list.select_id(first_id, {then_scroll: true, from_scroll: true});
const first_id = message_lists.current.first().id;
message_lists.current.select_id(first_id, {then_scroll: true, from_scroll: true});
}
export function to_end() {
const next_id = current_msg_list.last().id;
const next_id = message_lists.current.last().id;
message_viewport.set_last_movement_direction(1);
current_msg_list.select_id(next_id, {then_scroll: true, from_scroll: true});
if (current_msg_list.can_mark_messages_read()) {
message_lists.current.select_id(next_id, {then_scroll: true, from_scroll: true});
if (message_lists.current.can_mark_messages_read()) {
unread_ops.mark_current_list_as_read();
}
}
@ -104,17 +105,17 @@ export function page_down_the_right_amount() {
}
export function page_up() {
if (message_viewport.at_top() && !current_msg_list.empty()) {
current_msg_list.select_id(current_msg_list.first().id, {then_scroll: false});
if (message_viewport.at_top() && !message_lists.current.empty()) {
message_lists.current.select_id(message_lists.current.first().id, {then_scroll: false});
} else {
page_up_the_right_amount();
}
}
export function page_down() {
if (message_viewport.at_bottom() && !current_msg_list.empty()) {
current_msg_list.select_id(current_msg_list.last().id, {then_scroll: false});
if (current_msg_list.can_mark_messages_read()) {
if (message_viewport.at_bottom() && !message_lists.current.empty()) {
message_lists.current.select_id(message_lists.current.last().id, {then_scroll: false});
if (message_lists.current.can_mark_messages_read()) {
unread_ops.mark_current_list_as_read();
}
} else {
@ -123,7 +124,7 @@ export function page_down() {
}
export function scroll_to_selected() {
const selected_row = current_msg_list.selected_row();
const selected_row = message_lists.current.selected_row();
if (selected_row && selected_row.length !== 0) {
message_viewport.recenter_view(selected_row);
}

View File

@ -8,6 +8,7 @@ import * as blueslip from "./blueslip";
import * as channel from "./channel";
import * as favicon from "./favicon";
import {i18n} from "./i18n";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as muting from "./muting";
import * as narrow from "./narrow";
@ -519,7 +520,7 @@ function get_message_header(message) {
}
export function get_local_notify_mix_reason(message) {
const row = current_msg_list.get_row(message.id);
const row = message_lists.current.get_row(message.id);
if (row.length > 0) {
// If our message is in the current message list, we do
// not have a mix, so we are happy.
@ -605,7 +606,7 @@ export function notify_local_mixes(messages, need_user_to_scroll) {
}
// for callback when we have to check with the server if a message should be in
// the current_msg_list (!can_apply_locally; a.k.a. "a search").
// the message_lists.current (!can_apply_locally; a.k.a. "a search").
export function notify_messages_outside_current_search(messages) {
for (const message of messages) {
if (!people.is_current_user(message.sender_email)) {
@ -654,7 +655,7 @@ export function register_click_handlers() {
});
$("#out-of-view-notification").on("click", ".compose_notification_scroll_to_message", (e) => {
const message_id = $(e.currentTarget).data("message-id");
current_msg_list.select_id(message_id);
message_lists.current.select_id(message_id);
navigate.scroll_to_selected();
e.stopPropagation();
e.preventDefault();

View File

@ -27,6 +27,7 @@ import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_edit from "./message_edit";
import * as message_edit_history from "./message_edit_history";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as muting from "./muting";
import * as muting_ui from "./muting_ui";
@ -309,7 +310,7 @@ function show_user_info_popover_for_message(element, user, message) {
// by clicking on the same element that caused the popover.
return;
}
current_msg_list.select_id(message.id);
message_lists.current.select_id(message.id);
const elt = $(element);
if (elt.data("popover") === undefined) {
if (user === undefined) {
@ -487,7 +488,7 @@ function show_user_group_info_popover(element, group, message) {
// by clicking on the same element that caused the popover.
return;
}
current_msg_list.select_id(message.id);
message_lists.current.select_id(message.id);
const elt = $(element);
if (elt.data("popover") === undefined) {
const args = {
@ -517,10 +518,10 @@ export function toggle_actions_popover(element, id) {
}
$(element).closest(".message_row").toggleClass("has_popover has_actions_popover");
current_msg_list.select_id(id);
message_lists.current.select_id(id);
const elt = $(element);
if (elt.data("popover") === undefined) {
const message = current_msg_list.get(id);
const message = message_lists.current.get(id);
const editability = message_edit.get_editability(message);
let use_edit_icon;
let editability_menu_item;
@ -604,10 +605,10 @@ export function toggle_actions_popover(element, id) {
export function render_actions_remind_popover(element, id) {
hide_all();
$(element).closest(".message_row").toggleClass("has_popover has_actions_popover");
current_msg_list.select_id(id);
message_lists.current.select_id(id);
const elt = $(element);
if (elt.data("popover") === undefined) {
const message = current_msg_list.get(id);
const message = message_lists.current.get(id);
const args = {
message,
};
@ -818,7 +819,7 @@ export function show_sender_info() {
const $message = $(".selected_message");
const $sender = $message.find(".sender_info_hover");
const message = current_msg_list.get(rows.id($message));
const message = message_lists.current.get(rows.id($message));
const user = people.get_by_user_id(message.sender_id);
show_user_info_popover_for_message($sender[0], user, message);
if (current_message_info_popover_elem) {
@ -885,7 +886,7 @@ export function register_click_handlers() {
function (e) {
const row = $(this).closest(".message_row");
e.stopPropagation();
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
const user = people.get_by_user_id(message.sender_id);
show_user_info_popover_for_message(this, user, message);
},
@ -901,7 +902,7 @@ export function register_click_handlers() {
}
const row = $(this).closest(".message_row");
e.stopPropagation();
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
let user;
if (id_string) {
const user_id = Number.parseInt(id_string, 10);
@ -916,7 +917,7 @@ export function register_click_handlers() {
const user_group_id = Number.parseInt($(this).attr("data-user-group-id"), 10);
const row = $(this).closest(".message_row");
e.stopPropagation();
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
const group = user_groups.get_user_group_from_id(user_group_id, true);
if (group === undefined) {
// This user group has likely been deleted.
@ -1204,8 +1205,8 @@ export function register_click_handlers() {
});
$("body").on("click", ".popover_toggle_collapse", (e) => {
const message_id = $(e.currentTarget).data("message-id");
const row = current_msg_list.get_row(message_id);
const message = current_msg_list.get(rows.id(row));
const row = message_lists.current.get_row(message_id);
const message = message_lists.current.get(rows.id(row));
hide_actions_popover();
@ -1222,7 +1223,7 @@ export function register_click_handlers() {
});
$("body").on("click", ".popover_edit_message", (e) => {
const message_id = $(e.currentTarget).data("message-id");
const row = current_msg_list.get_row(message_id);
const row = message_lists.current.get_row(message_id);
hide_actions_popover();
message_edit.start(row);
e.stopPropagation();
@ -1230,8 +1231,8 @@ export function register_click_handlers() {
});
$("body").on("click", ".view_edit_history", (e) => {
const message_id = $(e.currentTarget).data("message-id");
const row = current_msg_list.get_row(message_id);
const message = current_msg_list.get(rows.id(row));
const row = message_lists.current.get_row(message_id);
const message = message_lists.current.get(rows.id(row));
const message_history_cancel_btn = $("#message-history-cancel");
hide_actions_popover();

View File

@ -8,6 +8,7 @@ import * as blueslip from "./blueslip";
import * as channel from "./channel";
import * as emoji_picker from "./emoji_picker";
import {i18n} from "./i18n";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import {page_params} from "./page_params";
import * as people from "./people";
@ -19,17 +20,17 @@ export function get_local_reaction_id(reaction_info) {
}
export function open_reactions_popover() {
const message = current_msg_list.selected_message();
const message = message_lists.current.selected_message();
let target;
// Use verbose style to ensure we test both sides of the condition.
if (message.sent_by_me) {
target = $(current_msg_list.selected_row()).find(".actions_hover")[0];
target = $(message_lists.current.selected_row()).find(".actions_hover")[0];
} else {
target = $(current_msg_list.selected_row()).find(".reaction_button")[0];
target = $(message_lists.current.selected_row()).find(".reaction_button")[0];
}
emoji_picker.toggle_emoji_popover(target, current_msg_list.selected_id());
emoji_picker.toggle_emoji_popover(target, message_lists.current.selected_id());
return true;
}

View File

@ -9,6 +9,7 @@ import {csrf_token} from "./csrf";
import * as hashchange from "./hashchange";
import {localstorage} from "./localstorage";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as narrow_state from "./narrow_state";
import {page_params} from "./page_params";
import * as reload_state from "./reload_state";
@ -51,20 +52,20 @@ function preserve_state(send_after_reload, save_pointer, save_narrow, save_compo
}
if (save_pointer) {
const pointer = home_msg_list.selected_id();
const pointer = message_lists.home.selected_id();
if (pointer !== -1) {
url += "+pointer=" + pointer;
}
}
if (save_narrow) {
const row = home_msg_list.selected_row();
const row = message_lists.home.selected_row();
if (!narrow_state.active()) {
if (row.length > 0) {
url += "+offset=" + row.offset().top;
}
} else {
url += "+offset=" + home_msg_list.pre_narrow_offset;
url += "+offset=" + message_lists.home.pre_narrow_offset;
const narrow_pointer = message_list.narrowed.selected_id();
if (narrow_pointer !== -1) {

View File

@ -4,6 +4,7 @@ import * as channel from "./channel";
import * as compose from "./compose";
import * as hash_util from "./hash_util";
import {i18n} from "./i18n";
import * as message_lists from "./message_lists";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as people from "./people";
@ -117,15 +118,15 @@ export function do_set_reminder_for_message(message_id, timestamp) {
});
}
const message = current_msg_list.get(message_id);
const message = message_lists.current.get(message_id);
if (!message.raw_content) {
const msg_list = current_msg_list;
const msg_list = message_lists.current;
channel.get({
url: "/json/messages/" + message.id,
idempotent: true,
success(data) {
if (current_msg_list === msg_list) {
if (message_lists.current === msg_list) {
message.raw_content = data.raw_content;
do_set_reminder_for_message(message_id, timestamp);
}

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import * as blueslip from "./blueslip";
import * as condense from "./condense";
import * as message_lists from "./message_lists";
import * as message_viewport from "./message_viewport";
import * as navigate from "./navigate";
import {page_params} from "./page_params";
@ -243,7 +244,7 @@ export function handler() {
// This function might run onReady (if we're in a narrow window),
// but before we've loaded in the messages; in that case, don't
// try to scroll to one.
if (current_msg_list.selected_id() !== -1) {
if (message_lists.current.selected_id() !== -1) {
if (mobile) {
popovers.set_suppress_scroll_hide();
}

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import * as blueslip from "./blueslip";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
// We don't need an andSelf() here because we already know
// that our next element is *not* a message_row, so this
@ -53,7 +54,7 @@ export function visible_range(start_id, end_id) {
const rows = [];
let row = current_msg_list.get_row(start_id);
let row = message_lists.current.get_row(start_id);
let msg_id = id(row);
while (msg_id <= end_id) {

View File

@ -5,6 +5,7 @@ import * as blueslip from "./blueslip";
import * as channel from "./channel";
import * as echo from "./echo";
import * as message_events from "./message_events";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import {page_params} from "./page_params";
import * as reload from "./reload";
@ -135,8 +136,8 @@ function get_events_success(events) {
}
}
if (home_msg_list.selected_id() === -1 && !home_msg_list.empty()) {
home_msg_list.select_id(home_msg_list.first().id, {then_scroll: false});
if (message_lists.home.selected_id() === -1 && !message_lists.home.empty()) {
message_lists.home.select_id(message_lists.home.first().id, {then_scroll: false});
}
if (update_message_events.length !== 0) {

View File

@ -18,6 +18,7 @@ import * as message_edit from "./message_edit";
import * as message_events from "./message_events";
import * as message_flags from "./message_flags";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as muting_ui from "./muting_ui";
import * as narrow_state from "./narrow_state";
import * as night_mode from "./night_mode";
@ -426,7 +427,7 @@ export function dispatch_normal_event(event) {
settings_streams.update_default_streams_table();
stream_data.remove_default_stream(stream.stream_id);
if (is_narrowed_to_stream) {
current_msg_list.update_trailing_bookend();
message_lists.current.update_trailing_bookend();
}
if (page_params.realm_notifications_stream_id === stream.stream_id) {
page_params.realm_notifications_stream_id = -1;
@ -560,8 +561,8 @@ export function dispatch_normal_event(event) {
}
if (event.setting_name === "twenty_four_hour_time") {
// Rerender the whole message list UI
home_msg_list.rerender();
if (current_msg_list === message_list.narrowed) {
message_lists.home.rerender();
if (message_lists.current === message_list.narrowed) {
message_list.narrowed.rerender();
}
}
@ -613,8 +614,8 @@ export function dispatch_normal_event(event) {
settings_display.report_emojiset_change();
// Rerender the whole message list UI
home_msg_list.rerender();
if (current_msg_list === message_list.narrowed) {
message_lists.home.rerender();
if (message_lists.current === message_list.narrowed) {
message_list.narrowed.rerender();
}
}

View File

@ -3,6 +3,7 @@ import $ from "jquery";
import * as blueslip from "./blueslip";
import * as color_data from "./color_data";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_util from "./message_util";
import * as message_view_header from "./message_view_header";
import * as narrow_state from "./narrow_state";
@ -126,7 +127,7 @@ export function mark_subscribed(sub, subscribers, color) {
message_view_header.maybe_rerender_title_area_for_stream(sub);
if (narrow_state.is_for_stream_id(sub.stream_id)) {
current_msg_list.update_trailing_bookend();
message_lists.current.update_trailing_bookend();
}
// Update unread counts as the new stream in sidebar might
@ -154,7 +155,7 @@ export function mark_unsubscribed(sub) {
}
if (narrow_state.is_for_stream_id(sub.stream_id)) {
current_msg_list.update_trailing_bookend();
message_lists.current.update_trailing_bookend();
}
stream_list.remove_sidebar_row(sub.stream_id);

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as message_util from "./message_util";
import * as message_viewport from "./message_viewport";
@ -18,30 +19,30 @@ export function update_is_muted(sub, value) {
if (overlays.is_active()) {
saved_ypos = message_viewport.scrollTop();
} else if (
home_msg_list === current_msg_list &&
current_msg_list.selected_row().offset() !== null
message_lists.home === message_lists.current &&
message_lists.current.selected_row().offset() !== null
) {
msg_offset = current_msg_list.selected_row().offset().top;
msg_offset = message_lists.current.selected_row().offset().top;
}
home_msg_list.clear({clear_selected_id: false});
message_lists.home.clear({clear_selected_id: false});
// Recreate the home_msg_list with the newly filtered message_list.all
message_util.add_old_messages(message_list.all.all_messages(), home_msg_list);
// Recreate the message_lists.home with the newly filtered message_list.all
message_util.add_old_messages(message_list.all.all_messages(), message_lists.home);
// Ensure we're still at the same scroll position
if (overlays.is_active()) {
message_viewport.scrollTop(saved_ypos);
} else if (home_msg_list === current_msg_list) {
} else if (message_lists.home === message_lists.current) {
// We pass use_closest to handle the case where the
// currently selected message is being hidden from the
// home view
home_msg_list.select_id(home_msg_list.selected_id(), {
message_lists.home.select_id(message_lists.home.selected_id(), {
use_closest: true,
empty_ok: true,
});
if (current_msg_list.selected_id() !== -1) {
current_msg_list.view.set_message_offset(msg_offset);
if (message_lists.current.selected_id() !== -1) {
message_lists.current.view.set_message_offset(msg_offset);
}
}
@ -53,8 +54,8 @@ export function update_is_muted(sub, value) {
navigate.plan_scroll_to_selected();
message_scroll.suppress_selection_update_on_next_scroll();
if (!home_msg_list.empty()) {
message_util.do_unread_count_updates(home_msg_list.all_messages());
if (!message_lists.home.empty()) {
message_util.do_unread_count_updates(message_lists.home.all_messages());
}
}, 0);

View File

@ -6,6 +6,7 @@ import * as common from "./common";
import {i18n} from "./i18n";
import {localstorage} from "./localstorage";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
// What, if anything, obscures the home tab?
@ -51,7 +52,7 @@ export function reset_scrollbar(element_selector) {
}
function update_message_in_all_views(message_id, callback) {
for (const list of [message_list.all, home_msg_list, message_list.narrowed]) {
for (const list of [message_list.all, message_lists.home, message_list.narrowed]) {
if (list === undefined) {
continue;
}

View File

@ -31,6 +31,7 @@ import * as markdown from "./markdown";
import * as markdown_config from "./markdown_config";
import * as message_edit from "./message_edit";
import * as message_fetch from "./message_fetch";
import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
import * as message_view_header from "./message_view_header";
import * as message_viewport from "./message_viewport";
@ -97,7 +98,7 @@ function message_hover(message_row) {
return;
}
const message = current_msg_list.get(rows.id(message_row));
const message = message_lists.current.get(rows.id(message_row));
message_unhover();
current_message_hover = message_row;
@ -266,7 +267,7 @@ export function initialize_kitchen_sink_stuff() {
});
$(document).on("message_selected.zulip", (event) => {
if (current_msg_list !== event.msg_list) {
if (message_lists.current !== event.msg_list) {
return;
}
if (event.id === -1) {
@ -279,7 +280,7 @@ export function initialize_kitchen_sink_stuff() {
if (event.then_scroll) {
if (row.length === 0) {
const row_from_dom = current_msg_list.get_row(event.id);
const row_from_dom = message_lists.current.get_row(event.id);
const messages = event.msg_list.all_messages();
blueslip.debug("message_selected missing selected row", {
previously_selected_id: event.previously_selected_id,
@ -291,7 +292,7 @@ export function initialize_kitchen_sink_stuff() {
selected_id_from_idx: messages[event.msg_list.selected_idx()].id,
msg_list_sorted: _.isEqual(
messages.map((message) => message.id),
current_msg_list
message_lists.current
.all_messages()
.map((message) => message.id)
.sort(),
@ -300,7 +301,7 @@ export function initialize_kitchen_sink_stuff() {
});
}
if (event.target_scroll_offset !== undefined) {
current_msg_list.view.set_message_offset(event.target_scroll_offset);
message_lists.current.view.set_message_offset(event.target_scroll_offset);
} else {
// Scroll to place the message within the current view;
// but if this is the initial placement of the pointer,
@ -316,7 +317,7 @@ export function initialize_kitchen_sink_stuff() {
$("#main_div").on("mouseenter", ".message_time", (e) => {
const time_elem = $(e.target);
const row = time_elem.closest(".message_row");
const message = current_msg_list.get(rows.id(row));
const message = message_lists.current.get(rows.id(row));
timerender.set_full_datetime(message, time_elem);
});
@ -475,6 +476,7 @@ export function initialize_everything() {
const user_status_params = pop_fields("user_status");
message_lists.initialize();
alert_popup.initialize();
alert_words.initialize(alert_words_params);
emojisets.initialize();

View File

@ -1,6 +1,7 @@
import * as channel from "./channel";
import * as message_flags from "./message_flags";
import * as message_list from "./message_list";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
import * as message_viewport from "./message_viewport";
import * as notifications from "./notifications";
@ -31,7 +32,7 @@ export function mark_all_as_read() {
}
function process_newly_read_message(message, options) {
home_msg_list.show_message_as_read(message, options);
message_lists.home.show_message_as_read(message, options);
message_list.all.show_message_as_read(message, options);
if (message_list.narrowed) {
message_list.narrowed.show_message_as_read(message, options);
@ -56,7 +57,7 @@ export function process_read_messages_event(message_ids) {
}
for (const message_id of message_ids) {
if (current_msg_list === message_list.narrowed) {
if (message_lists.current === message_list.narrowed) {
// I'm not sure this entirely makes sense for all server
// notifications.
unread.set_messages_read_in_narrow(true);
@ -86,7 +87,7 @@ export function notify_server_messages_read(messages, options) {
message_flags.send_read(messages);
for (const message of messages) {
if (current_msg_list === message_list.narrowed) {
if (message_lists.current === message_list.narrowed) {
unread.set_messages_read_in_narrow(true);
}
@ -108,13 +109,16 @@ export function process_visible() {
return;
}
if (message_viewport.bottom_message_visible() && current_msg_list.can_mark_messages_read()) {
if (
message_viewport.bottom_message_visible() &&
message_lists.current.can_mark_messages_read()
) {
mark_current_list_as_read();
}
}
export function mark_current_list_as_read(options) {
notify_server_messages_read(current_msg_list.all_messages(), options);
notify_server_messages_read(message_lists.current.all_messages(), options);
}
export function mark_stream_as_read(stream_id, cont) {

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import * as blueslip from "./blueslip";
import * as message_lists from "./message_lists";
import * as narrow_state from "./narrow_state";
import * as poll_widget from "./poll_widget";
import * as todo_widget from "./todo_widget";
@ -84,8 +85,8 @@ export function activate(in_opts) {
export function set_widgets_for_list() {
for (const [idx, widget_elem] of widget_contents) {
if (current_msg_list.get(idx) !== undefined) {
const row = current_msg_list.get_row(idx);
if (message_lists.current.get(idx) !== undefined) {
const row = message_lists.current.get_row(idx);
set_widget_in_message(row, widget_elem);
}
}

View File

@ -1,19 +0,0 @@
/* eslint-env commonjs */
"use strict";
const {Filter} = require("./filter");
const message_list = require("./message_list");
// This file is being eliminated as part of the general purge of
// global variables from Zulip (everything is being moved into
// modules). Please don't add things here.
const home_msg_list = new message_list.MessageList({
table_name: "zhome",
filter: new Filter([{operator: "in", operand: "home"}]),
excludes_muted_topics: true,
});
window.home_msg_list = home_msg_list;
window.current_msg_list = home_msg_list;

View File

@ -7,6 +7,7 @@ export {
wildcard_mention_large_stream_threshold,
} from "./compose";
export {private_message_recipient} from "./compose_state";
export {current as current_msg_list} from "./message_lists";
export {get_stream_id, get_sub, get_subscriber_count} from "./stream_data";
export {get_by_user_id as get_person_by_user_id, get_user_id_from_name} from "./people";
export {last_visible as last_visible_row, id as row_id} from "./rows";

View File

@ -84,6 +84,7 @@ EXEMPT_FILES = {
"static/js/message_list_data.js",
"static/js/message_list.js",
"static/js/message_list_view.js",
"static/js/message_lists.js",
"static/js/message_live_update.js",
"static/js/message_scroll.js",
"static/js/message_util.js",