From 225b4c6925aee2fe48357a5a63209891e13beee9 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 6 Jan 2014 16:56:40 -0500 Subject: [PATCH] Match full names in Streams autocomplete. See #2137. When you add a person to a stream on the Streams page, the autocomplete will now match on the person's full name, not just their email. (imported from commit b250ea0dc61d54f7f2f330ef0616935d43234597) --- static/js/subs.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/subs.js b/static/js/subs.js index d90a91c9a4..ddc3776478 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -929,12 +929,13 @@ $(function () { return typeahead_helper.highlight_with_escaping(this.query, item_formatted); }, matcher: function (item) { - var query = $.trim(this.query); + var query = $.trim(this.query.toLowerCase()); if (query === '' || query === item.email) { return false; } // Case-insensitive. - return (item.email.toLowerCase().indexOf(query.toLowerCase()) !== -1); + return (item.email.toLowerCase().indexOf(query) !== -1) || + (item.full_name.toLowerCase().indexOf(query) !== -1); }, sorter: typeahead_helper.sort_recipientbox_typeahead, updater: function (item) {