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)
This commit is contained in:
Steve Howell
2014-01-06 16:56:40 -05:00
parent 8f865af0c1
commit 225b4c6925

View File

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