From 79af591b4141f8ea2095de712ed9915747e8b517 Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Fri, 12 Jul 2013 17:34:36 -0400 Subject: [PATCH] Show an item for @all in the autocomplete list. Trac #1509 (imported from commit 4bc5f088a354dea4ffaf98ac2d988d9d05b19d51) --- zephyr/static/js/composebox_typeahead.js | 10 +++++++++- zephyr/static/js/typeahead_helper.js | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/zephyr/static/js/composebox_typeahead.js b/zephyr/static/js/composebox_typeahead.js index d97ba5c40c..91935f533f 100644 --- a/zephyr/static/js/composebox_typeahead.js +++ b/zephyr/static/js/composebox_typeahead.js @@ -282,7 +282,15 @@ exports.initialize = function () { } else { this.completing = 'mention'; this.token = current_token.substring(current_token.indexOf("@")+1); - return page_params.people_list; + var all_item = { + special_item_text: "all (Notify everyone)", + email: "all", + // Always sort above, under the assumption that names will + // be longer and only contain "all" as a substring. + pm_recipient_count: Infinity, + full_name: "all" + }; + return page_params.people_list.concat([all_item]); } }, items: 5, diff --git a/zephyr/static/js/typeahead_helper.js b/zephyr/static/js/typeahead_helper.js index 490c311668..3d92c4f1f7 100644 --- a/zephyr/static/js/typeahead_helper.js +++ b/zephyr/static/js/typeahead_helper.js @@ -75,6 +75,9 @@ exports.private_message_typeahead_list = []; exports.private_message_mapped = {}; exports.render_person = function (person) { + if (person.special_item_text){ + return person.special_item_text; + } return person.full_name + " <" + person.email + ">"; };