mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 17:02:45 +08:00
FIX: group tag notifications included for all users
Regression from my last commit
This commit is contained in:
parent
04be39ed46
commit
b207842720
|
@ -101,7 +101,8 @@ class GroupShowSerializer < BasicGroupSerializer
|
|||
end
|
||||
|
||||
define_method("include_#{level}_tags?") do
|
||||
SiteSetting.tagging_enabled?
|
||||
SiteSetting.tagging_enabled? &&
|
||||
scope.is_admin? || (include_is_group_owner? && is_group_owner)
|
||||
end
|
||||
|
||||
define_method("#{level}_tags") do
|
||||
|
|
|
@ -91,6 +91,8 @@ describe GroupShowSerializer do
|
|||
let(:tag2) { Fabricate(:tag) }
|
||||
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
|
||||
GroupCategoryNotificationDefault.create!(
|
||||
group: group,
|
||||
category: category1,
|
||||
|
@ -138,6 +140,12 @@ describe GroupShowSerializer do
|
|||
expect(subject.as_json[:regular_tags]).to eq([])
|
||||
expect(subject.as_json[:muted_tags]).to eq([])
|
||||
end
|
||||
|
||||
it "doesn't include tag fields if tags are disabled" do
|
||||
SiteSetting.tagging_enabled = false
|
||||
expect(subject.as_json.keys.select { |k| k.to_s.ends_with?("_category_ids") }.length).to eq(5)
|
||||
expect(subject.as_json.keys.select { |k| k.to_s.ends_with?("_tags") }).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user