mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
FIX: Incorrect query when removing a group owner.
https://meta.discourse.org/t/group-rename-and-group-owners-removal-problems/85596
This commit is contained in:
parent
b618ffb715
commit
aa0d32231c
@ -105,7 +105,7 @@ class Admin::GroupsController < Admin::AdminController
|
||||
end
|
||||
|
||||
def remove_owner
|
||||
group = Group.find_by(params.require(:id))
|
||||
group = Group.find_by(id: params.require(:id))
|
||||
raise Discourse::NotFound unless group
|
||||
|
||||
return can_not_modify_automatic if group.automatic
|
||||
|
@ -51,6 +51,19 @@ RSpec.describe Admin::GroupsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#remove_owner' do
|
||||
it 'should work' do
|
||||
group.add_owner(user)
|
||||
|
||||
delete "/admin/groups/#{group.id}/owners.json", params: {
|
||||
user_id: user.id
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(group.group_users.where(owner: true)).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
describe "#bulk_perform" do
|
||||
let(:group) do
|
||||
Fabricate(:group,
|
||||
|
Loading…
x
Reference in New Issue
Block a user