diff --git a/app/assets/javascripts/discourse/models/topic_list.js b/app/assets/javascripts/discourse/models/topic_list.js index 6317f1a8c..13458955f 100644 --- a/app/assets/javascripts/discourse/models/topic_list.js +++ b/app/assets/javascripts/discourse/models/topic_list.js @@ -12,17 +12,17 @@ function finderFor(filter, params) { var url = Discourse.getURL("/") + filter + ".json"; if (params) { - var keys = Object.keys(params); + var keys = Object.keys(params), + encoded = []; - if (keys.length > 0) { - var encoded = []; - keys.forEach(function(p) { - var value = params[p]; - if (typeof value !== 'undefined') { - encoded.push(p + "=" + value); - } - }); + keys.forEach(function(p) { + var value = params[p]; + if (typeof value !== 'undefined') { + encoded.push(p + "=" + value); + } + }); + if (encoded.length > 0) { url += "?" + encoded.join('&'); } }