user_pill: Add Zephyr logic.

For Zephyr realms we have to be more lax with email validation.

This will be relevant for compose pills.
This commit is contained in:
Steve Howell
2018-03-07 07:34:05 -05:00
committed by Tim Abbott
parent f0d101edf5
commit 1aba722e63

View File

@@ -10,6 +10,23 @@ exports.create_item_from_email = function (email, current_items) {
var user = people.get_by_email(email);
if (!user) {
if (page_params.realm_is_zephyr_mirror_realm) {
var existing_emails = _.pluck(current_items, 'email');
if (existing_emails.indexOf(email) >= 0) {
return;
}
// For Zephyr we can't assume any emails are invalid,
// so we just create a pill where the display value
// is the email itself.
return {
display_value: email,
email: email,
};
}
// The email is not allowed, so return.
return;
}