diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js index 6cd2d935b5..4f2ca89c81 100644 --- a/frontend_tests/node_tests/settings_user_groups.js +++ b/frontend_tests/node_tests/settings_user_groups.js @@ -232,12 +232,12 @@ test_ui("populate_user_groups", (override) => { })(); (function test_sorter() { - let sort_recipientbox_typeahead_called = false; - typeahead_helper.sort_recipientbox_typeahead = () => { - sort_recipientbox_typeahead_called = true; + let sort_recipients_typeahead_called = false; + typeahead_helper.sort_recipients = function () { + sort_recipients_typeahead_called = true; }; config.sorter.call(fake_context); - assert(sort_recipientbox_typeahead_called); + assert(sort_recipients_typeahead_called); })(); (function test_updater() { diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index 4ff3481b09..ae76d016f2 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -733,29 +733,3 @@ test("sort_slash_commands", () => { {name: "test"}, ]); }); - -test("sort_recipientbox_typeahead", () => { - let recipients = th.sort_recipientbox_typeahead("b, a", matches, ""); // search "a" - let recipients_email = recipients.map((person) => person.email); - assert.deepEqual(recipients_email, [ - "a_user@zulip.org", // matches "a" - "a_bot@zulip.com", // matches "a" - "b_user_1@zulip.net", - "b_user_2@zulip.net", - "b_user_3@zulip.net", - "zman@test.net", - "b_bot@example.com", - ]); - - recipients = th.sort_recipientbox_typeahead("b, a, b", matches, ""); // search "b" - recipients_email = recipients.map((person) => person.email); - assert.deepEqual(recipients_email, [ - "b_user_1@zulip.net", - "b_user_2@zulip.net", - "b_user_3@zulip.net", - "b_bot@example.com", - "a_user@zulip.org", - "zman@test.net", - "a_bot@zulip.com", - ]); -}); diff --git a/static/js/pill_typeahead.js b/static/js/pill_typeahead.js index 4e36bafd75..ac2c2a9f7b 100644 --- a/static/js/pill_typeahead.js +++ b/static/js/pill_typeahead.js @@ -51,7 +51,7 @@ export function set_up(input, pills, opts) { return typeahead_helper.sort_streams(matches, this.query.trim().slice(1)); } - return typeahead_helper.sort_recipientbox_typeahead(this.query, matches, ""); + return typeahead_helper.sort_recipients(matches, this.query, ""); }, updater(item) { if (include_streams(this.query)) { diff --git a/static/js/typeahead_helper.js b/static/js/typeahead_helper.js index 5153c6fc22..17293db380 100644 --- a/static/js/typeahead_helper.js +++ b/static/js/typeahead_helper.js @@ -380,10 +380,3 @@ export function sort_streams(matches, query) { return name_results.matches.concat(desc_results.matches.concat(desc_results.rest)); } - -export function sort_recipientbox_typeahead(query, matches, current_stream) { - // input_text may be one or more pm recipients - const cleaned = get_cleaned_pm_recipients(query); - query = cleaned[cleaned.length - 1]; - return sort_recipients(matches, query, current_stream); -}