refactor: Remove redundant typeahead_helper.sort_recipientbox_typeahead.

This commit removes`typeahead_helper.sort_recipientbox_typeahead`
which was introduced in 639ec9380a
for the private message recipient box when it used to accept comma
separated text input for recipients. All it doew was cleaning away
invalid recipients from string, like:
"a, , b" was cleaned to [a, b].

This can be now removed because it was now used only in
pill_typeahead.setup code path, and the pills code already handles
invalid cases by filtering out all falsy (invalid) recipients.
This commit is contained in:
ryanreh99
2020-10-10 18:25:42 +05:30
committed by Tim Abbott
parent a8106a641b
commit e4d5ea69a0
4 changed files with 5 additions and 38 deletions

View File

@@ -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() {

View File

@@ -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",
]);
});