mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: tag input doesn't show staff-only tags to non-staff
This commit is contained in:
parent
af1c994940
commit
3d5716a2c8
2 changed files with 6 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue