FIX: group tag notifications included for all users

FIX: group tag notifications included for all users

Regression from my last commit

diff --git a/app/serializers/group_show_serializer.rb b/app/serializers/group_show_serializer.rb
index 6097854..53a6f0d 100644
--- a/app/serializers/group_show_serializer.rb
+++ b/app/serializers/group_show_serializer.rb
@@ -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
diff --git a/spec/serializers/group_show_serializer_spec.rb b/spec/serializers/group_show_serializer_spec.rb
index 597e0bf..a6acacd 100644
--- a/spec/serializers/group_show_serializer_spec.rb
+++ b/spec/serializers/group_show_serializer_spec.rb
@@ -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

GitHub sha: b2078427