Wait for 2 characters before querying interest bar.

This commit is contained in:
Max Goodman
2012-09-13 23:27:03 -07:00
parent a58624b8e6
commit 2b53fab01f
2 changed files with 4 additions and 3 deletions

View File

@@ -2871,7 +2871,8 @@ class ApiController(RedditController, OAuth2ResourceController):
if not g.CLOUDSEARCH_SEARCH_API:
return []
if not query or not query.strip():
query = query and query.strip()
if not query or len(query) < 2:
return []
exclude = Subreddit.default_subreddits()

View File

@@ -29,7 +29,7 @@ r.ui.InterestBar.prototype = {
}
this.queryChangedDebounced(query)
if (query) {
if (query && query.length > 1) {
this.$el.addClass('working')
} else {
this.hideResults()
@@ -38,7 +38,7 @@ r.ui.InterestBar.prototype = {
},
queryChanged: function(query) {
if (query) {
if (query && query.length > 1) {
$.ajax({
url: '/api/subreddits_by_topic.json',
data: {'query': query},