diff --git a/app/assets/javascripts/discourse/components/tag-chooser.js.es6 b/app/assets/javascripts/discourse/components/tag-chooser.js.es6 index c942cf599..88e7577d1 100644 --- a/app/assets/javascripts/discourse/components/tag-chooser.js.es6 +++ b/app/assets/javascripts/discourse/components/tag-chooser.js.es6 @@ -78,7 +78,7 @@ export default Ember.TextField.extend({ url: Discourse.getURL("/tags/filter/search"), dataType: 'json', data: function (term) { - return { q: term, limit: self.siteSettings.max_tag_search_results }; + return { q: term, limit: self.siteSettings.max_tag_search_results, filterForInput: true }; }, results: function (data) { if (self.siteSettings.tags_sort_alphabetically) { diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 23eac8886..c5040d3a2 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -112,6 +112,11 @@ class TagsController < ::ApplicationController query = query.where('tags.name like ?', "%#{term}%") end + if params[:filterForInput] && !guardian.is_staff? + staff_tag_names = SiteSetting.staff_tags.split("|") + query = query.where('tags.name NOT IN (?)', staff_tag_names) if staff_tag_names.present? + end + tags = query.count.map {|t, c| { id: t, text: t, count: c } } render json: { results: tags }