mirror of https://github.com/zulip/zulip.git
minor: Inline filter_table in subs.js.
The old structure of having a two-line wrapper was mostly driven by testing concerns. Now I just have a single function with the optional argument.
This commit is contained in:
parent
c3ee1286f4
commit
fed1eaf7d7
|
@ -27,7 +27,7 @@ set_global("hash_util", {
|
|||
by_stream_uri: () => {},
|
||||
});
|
||||
|
||||
run_test("filter_table", (override) => {
|
||||
run_test("redraw_left_panel", (override) => {
|
||||
override(subs, "add_tooltip_to_left_panel_row", () => {});
|
||||
|
||||
// set-up sub rows stubs
|
||||
|
@ -124,7 +124,7 @@ run_test("filter_table", (override) => {
|
|||
assert(!denmark_row.hasClass("active"));
|
||||
|
||||
function test_filter(params, expected_streams) {
|
||||
const stream_ids = subs.filter_table(params);
|
||||
const stream_ids = subs.redraw_left_panel(params);
|
||||
assert.deepEqual(
|
||||
stream_ids,
|
||||
expected_streams.map((sub) => sub.stream_id),
|
||||
|
|
|
@ -429,7 +429,13 @@ exports.render_left_panel_superset = function () {
|
|||
};
|
||||
|
||||
// LeftPanelParams { input: String, subscribed_only: Boolean, sort_order: String }
|
||||
exports.filter_table = function (left_panel_params) {
|
||||
exports.redraw_left_panel = function (left_panel_params) {
|
||||
// We only get left_panel_params passed in from tests. Real
|
||||
// code calls get_left_panel_params().
|
||||
if (left_panel_params === undefined) {
|
||||
left_panel_params = exports.get_left_panel_params();
|
||||
}
|
||||
|
||||
exports.show_active_stream_in_left_panel();
|
||||
|
||||
function stream_id_for_row(row) {
|
||||
|
@ -508,11 +514,6 @@ exports.maybe_reset_right_panel = function () {
|
|||
}
|
||||
};
|
||||
|
||||
exports.redraw_left_panel = function () {
|
||||
const left_panel_params = exports.get_left_panel_params();
|
||||
exports.filter_table(left_panel_params);
|
||||
};
|
||||
|
||||
// Make it explicit that our toggler is not created right away.
|
||||
exports.toggler = undefined;
|
||||
|
||||
|
|
Loading…
Reference in New Issue