mirror of https://github.com/zulip/zulip.git
Be more clever about whitespace in typeahead for adding subscribers
* Ignore beginning and ending whitespace when submitting the form * Ignore beginning and ending whitespace when doing autocomplete * Don't autocomplete on just whitespace (imported from commit b3231e08f6797a38bafbcef2e694f4bae059c20f)
This commit is contained in:
parent
cd60f18752
commit
3442ac05b8
|
@ -307,7 +307,7 @@ $(function () {
|
|||
var sub_row = $(e.target).closest('.subscription_row');
|
||||
var stream = sub_row.find('.subscription_name').text();
|
||||
var text_box = sub_row.find('input[name="principal"]');
|
||||
var principal = text_box.val();
|
||||
var principal = $.trim(text_box.val());
|
||||
// TODO: clean up this error handling
|
||||
var error_elem = sub_row.find('.subscriber_list_container .alert-error');
|
||||
var warning_elem = sub_row.find('.subscriber_list_container .alert-warning');
|
||||
|
@ -368,6 +368,14 @@ $(function () {
|
|||
var query = this.query;
|
||||
return typeahead_helper.highlight_with_escaping(query, item);
|
||||
},
|
||||
matcher: function (item) {
|
||||
var query = $.trim(this.query);
|
||||
if (query === '') {
|
||||
return false;
|
||||
}
|
||||
// Case-insensitive.
|
||||
return (item.toLowerCase().indexOf(query.toLowerCase()) !== -1);
|
||||
},
|
||||
updater: function (item) {
|
||||
return typeahead_helper.private_message_mapped[item].email;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue