FIX: allow moderators to create categories setting broken
Mods require visibility to everyone group cause category dialogs need to know about this.
If the site setting
allow moderators to create categories will not function
Note there is no security expansion of rights here, the group is technically empty anyway and it always looks exactly the same on all discourse instances
diff --git a/app/models/group.rb b/app/models/group.rb index 0f29590..65bc2c7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -290,7 +290,7 @@ class Group < ActiveRecord::Base # way to have the membership in a table case name when :everyone - group.visibility_level = Group.visibility_levels[:owners] + group.visibility_level = Group.visibility_levels[:staff] group.save! return group when :moderators diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 8419e89..c705704 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -221,9 +221,9 @@ describe Group do end describe '.refresh_automatic_group!' do - it "makes sure the everyone group is not visible" do + it "makes sure the everyone group is not visible except to staff" do g = Group.refresh_automatic_group!(:everyone) - expect(g.visibility_level).to eq(Group.visibility_levels[:owners]) + expect(g.visibility_level).to eq(Group.visibility_levels[:staff]) end it "ensures that the moderators group is messageable by all" do
GitHub sha: 8d7c10f7