Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Remove redundant typeahead_helper.sort_recipientbox_typeahead.

ryanreh99e4d5ea69a01c
diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js
index 6cd2d935b54..4f2ca89c810 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 4ff3481b094..ae76d016f21 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, [
- "[email protected]", // matches "a"
- "[email protected]", // matches "a"
- ]);
-
- recipients = th.sort_recipientbox_typeahead("b, a, b", matches, ""); // search "b"
- recipients_email = recipients.map((person) => person.email);
- assert.deepEqual(recipients_email, [
- ]);
-});
diff --git a/static/js/pill_typeahead.js b/static/js/pill_typeahead.js
index 4e36bafd753..ac2c2a9f7b3 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 5153c6fc227..17293db3807 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);
-}