Remove user from a group by user email
This commit is contained in:
parent
973a7c9d3a
commit
dffd8baa91
|
@ -128,6 +128,8 @@ class GroupsController < ApplicationController
|
|||
user = User.find(params[:user_id])
|
||||
elsif params[:username].present?
|
||||
user = User.find_by_username(params[:username])
|
||||
elsif params[:user_email].present?
|
||||
user = User.find_by_email(params[:user_email])
|
||||
else
|
||||
raise Discourse::InvalidParameters.new('user_id or username must be present')
|
||||
end
|
||||
|
|
|
@ -224,6 +224,13 @@ describe GroupsController do
|
|||
user.reload
|
||||
expect(user.primary_group_id).to eq(nil)
|
||||
end
|
||||
|
||||
it "removes by user_email" do
|
||||
xhr :delete, :remove_member, id: group.id, user_email: user.email
|
||||
expect(response).to be_success
|
||||
group.reload
|
||||
expect(group.users.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue