A platform for community discussion. Free, open, simple.
FIX: Allow staff to change group members visibility level for automatic groups (#25281)
Penar Musaraj719956f2559a
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex 9956a5534d5..e796ce0c642 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -740,9 +740,7 @@ class GroupsController < ApplicationControllerflair_upload_id]- if automatic- attributes.push(:visibility_level)- else+ if !automaticattributes.push(:title,:allow_membership_requests,@@ -753,6 +751,8 @@ class GroupsController < ApplicationController)end+ attributes.push(:visibility_level, :members_visibility_level) if current_user.staff?+if !automatic && current_user.staff?attributes.push(:incoming_email,@@ -773,8 +773,6 @@ class GroupsController < ApplicationController:email_password,:email_from_alias,:primary_group,- :visibility_level,- :members_visibility_level,:name,:grant_trust_level,:automatic_membership_email_domains,diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex 11496a4d019..60b27d397f7 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -994,6 +994,7 @@ RSpec.describe GroupsController domentionable_level: 2,messageable_level: 2,default_notification_level: 2,+ members_visibility_level: 2,)put "/groups/#{group.id}.json",@@ -1007,6 +1008,7 @@ RSpec.describe GroupsController domentionable_level: 1,messageable_level: 1,default_notification_level: 1,+ members_visibility_level: 1,tracking_category_ids: [category.id],tracking_tags: [tag.name],},@@ -1025,6 +1027,7 @@ RSpec.describe GroupsController doexpect(group.mentionable_level).to eq(1)expect(group.messageable_level).to eq(1)expect(group.default_notification_level).to eq(1)+ expect(group.members_visibility_level).to eq(1)expect(group.group_category_notification_defaults.first&.category).to eq(category)expect(group.group_tag_notification_defaults.first&.tag).to eq(tag)end