FIX: Searching for spaces wouldn't stop spinning

This commit is contained in:
Robin Ward 2014-02-04 13:19:36 -05:00
parent abffcd9f94
commit 36683ff1e3
1 changed files with 4 additions and 2 deletions

View File

@ -11,8 +11,8 @@ Discourse.SearchController = Em.ArrayController.extend(Discourse.Presence, {
// If we need to perform another search
newSearchNeeded: function() {
this.set('noResults', false);
var term = this.get('term');
if (term && term.length >= Discourse.SiteSettings.min_search_term_length) {
var term = (this.get('term') || '').trim();
if (term.length >= Discourse.SiteSettings.min_search_term_length) {
this.set('loading', true);
this.searchTerm(term, this.get('typeFilter'));
} else {
@ -57,6 +57,8 @@ Discourse.SearchController = Em.ArrayController.extend(Discourse.Presence, {
self.set('urls', urls);
}
self.set('loading', false);
}).catch(function() {
self.set('loading', false);
});
}, 300),