mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
FIX: Allow staff to change group members visibility level for automatic groups (#25281)
This commit is contained in:
@ -740,9 +740,7 @@ class GroupsController < ApplicationController
|
|||||||
flair_upload_id
|
flair_upload_id
|
||||||
]
|
]
|
||||||
|
|
||||||
if automatic
|
if !automatic
|
||||||
attributes.push(:visibility_level)
|
|
||||||
else
|
|
||||||
attributes.push(
|
attributes.push(
|
||||||
:title,
|
:title,
|
||||||
:allow_membership_requests,
|
:allow_membership_requests,
|
||||||
@ -753,6 +751,8 @@ class GroupsController < ApplicationController
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
attributes.push(:visibility_level, :members_visibility_level) if current_user.staff?
|
||||||
|
|
||||||
if !automatic && current_user.staff?
|
if !automatic && current_user.staff?
|
||||||
attributes.push(
|
attributes.push(
|
||||||
:incoming_email,
|
:incoming_email,
|
||||||
@ -773,8 +773,6 @@ class GroupsController < ApplicationController
|
|||||||
:email_password,
|
:email_password,
|
||||||
:email_from_alias,
|
:email_from_alias,
|
||||||
:primary_group,
|
:primary_group,
|
||||||
:visibility_level,
|
|
||||||
:members_visibility_level,
|
|
||||||
:name,
|
:name,
|
||||||
:grant_trust_level,
|
:grant_trust_level,
|
||||||
:automatic_membership_email_domains,
|
:automatic_membership_email_domains,
|
||||||
|
@ -994,6 +994,7 @@ RSpec.describe GroupsController do
|
|||||||
mentionable_level: 2,
|
mentionable_level: 2,
|
||||||
messageable_level: 2,
|
messageable_level: 2,
|
||||||
default_notification_level: 2,
|
default_notification_level: 2,
|
||||||
|
members_visibility_level: 2,
|
||||||
)
|
)
|
||||||
|
|
||||||
put "/groups/#{group.id}.json",
|
put "/groups/#{group.id}.json",
|
||||||
@ -1007,6 +1008,7 @@ RSpec.describe GroupsController do
|
|||||||
mentionable_level: 1,
|
mentionable_level: 1,
|
||||||
messageable_level: 1,
|
messageable_level: 1,
|
||||||
default_notification_level: 1,
|
default_notification_level: 1,
|
||||||
|
members_visibility_level: 1,
|
||||||
tracking_category_ids: [category.id],
|
tracking_category_ids: [category.id],
|
||||||
tracking_tags: [tag.name],
|
tracking_tags: [tag.name],
|
||||||
},
|
},
|
||||||
@ -1025,6 +1027,7 @@ RSpec.describe GroupsController do
|
|||||||
expect(group.mentionable_level).to eq(1)
|
expect(group.mentionable_level).to eq(1)
|
||||||
expect(group.messageable_level).to eq(1)
|
expect(group.messageable_level).to eq(1)
|
||||||
expect(group.default_notification_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_category_notification_defaults.first&.category).to eq(category)
|
||||||
expect(group.group_tag_notification_defaults.first&.tag).to eq(tag)
|
expect(group.group_tag_notification_defaults.first&.tag).to eq(tag)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user