compose pill: Add has_unconverted_data() helper.

This commit is contained in:
Steve Howell
2018-09-17 23:40:27 +00:00
committed by Tim Abbott
parent 3225f81a92
commit 27ef6a9991
3 changed files with 48 additions and 0 deletions

View File

@@ -76,6 +76,21 @@ exports.get_user_ids = function (pill_widget) {
return user_ids;
};
exports.has_unconverted_data = function (pill_widget) {
// This returns true if we either have text that hasn't been
// turned into pills or email-only pills (for Zephyr).
if (pill_widget.is_pending()) {
return true;
}
var items = pill_widget.items();
var has_unknown_items = _.any(items, function (item) {
return item.user_id === undefined;
});
return has_unknown_items;
};
exports.typeahead_source = function (pill_widget) {
var items = people.get_realm_persons();
var taken_user_ids = exports.get_user_ids(pill_widget);