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
|
end
|
||||||
|
|
||||||
def remove_owner
|
def remove_owner
|
||||||
group = Group.find_by(params.require(:id))
|
group = Group.find_by(id: params.require(:id))
|
||||||
raise Discourse::NotFound unless group
|
raise Discourse::NotFound unless group
|
||||||
|
|
||||||
return can_not_modify_automatic if group.automatic
|
return can_not_modify_automatic if group.automatic
|
||||||
|
|
|
@ -51,6 +51,19 @@ RSpec.describe Admin::GroupsController do
|
||||||
end
|
end
|
||||||
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
|
describe "#bulk_perform" do
|
||||||
let(:group) do
|
let(:group) do
|
||||||
Fabricate(:group,
|
Fabricate(:group,
|
||||||
|
|
Loading…
Reference in New Issue