From 4e78d189724b2006af76d2ed6341ff4f3bae4022 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Fri, 25 Jan 2013 12:09:41 -0500 Subject: [PATCH] Lookahead on @-searches by removing the @ (imported from commit fd8b4dd19db4f291387397a3a795cf9ade5b195a) --- zephyr/static/js/typeahead_helper.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zephyr/static/js/typeahead_helper.js b/zephyr/static/js/typeahead_helper.js index 3ad318abee..3876c14d95 100644 --- a/zephyr/static/js/typeahead_helper.js +++ b/zephyr/static/js/typeahead_helper.js @@ -141,8 +141,12 @@ exports.sort_subjects = function (items) { }; exports.sort_recipients = function (matches) { - var name_results = prefix_sort(this.query, matches, identity); - var email_results = prefix_sort(this.query, name_results.rest, email_from_identity); + var query = this.query; + if (query[0] === '@') + query = query.substring(1); + + var name_results = prefix_sort(query, matches, identity); + var email_results = prefix_sort(query, name_results.rest, email_from_identity); var sorted_by_pms = exports.sort_by_pms(email_results.rest); return name_results.matches.concat(email_results.matches.concat(sorted_by_pms)); };