mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 11:13:38 +08:00
FIX: Can't update Groups#allow_membership_requests
in admin.
This commit is contained in:
parent
c15bf62b43
commit
7c7c233c1c
|
@ -71,6 +71,10 @@ class Admin::GroupsController < Admin::AdminController
|
|||
group.bio_raw = group_params[:bio_raw] if group_params[:bio_raw]
|
||||
group.full_name = group_params[:full_name] if group_params[:full_name]
|
||||
|
||||
if group_params[:allow_membership_requests]
|
||||
group.allow_membership_requests = group_params[:allow_membership_requests]
|
||||
end
|
||||
|
||||
if group.save
|
||||
Group.reset_counters(group.id, :group_users)
|
||||
|
||||
|
|
|
@ -88,14 +88,19 @@ describe Admin::GroupsController do
|
|||
|
||||
it "ignore name change on automatic group" do
|
||||
expect do
|
||||
xhr :put, :update, { id: 1, group: { name: "WAT", visible: "true" } }
|
||||
end.to_not change { GroupHistory.count }
|
||||
xhr :put, :update, { id: 1, group: {
|
||||
name: "WAT",
|
||||
visible: "true",
|
||||
allow_membership_requests: "true"
|
||||
} }
|
||||
end.to change { GroupHistory.count }.by(1)
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
group = Group.find(1)
|
||||
expect(group.name).not_to eq("WAT")
|
||||
expect(group.visible).to eq(true)
|
||||
expect(group.allow_membership_requests).to eq(true)
|
||||
end
|
||||
|
||||
it "doesn't launch the 'automatic group membership' job when it's not retroactive" do
|
||||
|
|
|
@ -84,6 +84,8 @@ describe "Groups" do
|
|||
end
|
||||
|
||||
it "should be able update the group" do
|
||||
group.update!(allow_membership_requests: false)
|
||||
|
||||
expect do
|
||||
xhr :put, "/groups/#{group.id}", { group: {
|
||||
flair_bg_color: 'FFF',
|
||||
|
|
Loading…
Reference in New Issue
Block a user