1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

(bug) Unable to change the group of a user

This commit is contained in:
Sylvain 2022-07-19 16:08:24 +02:00
parent c710af04b7
commit e9a7b609bb
3 changed files with 26 additions and 4 deletions

View File

@ -7,6 +7,7 @@
- Display bookers names to connected users now apply to all resources
- Fix a bug: unable to book a space's slot with an existing reservation
- Fix a bug: Unable to import accounts from SSO when the transformation modal was opened but leaved empty
- Fix a bug: Unable to change the group of a user
## v5.4.12 2022 July 06

View File

@ -36,10 +36,12 @@ class Members::MembersService
end
end
if params[:invoicing_profile_attributes][:organization] == 'false'
params[:invoicing_profile_attributes].reject! { |p| %w[organization_attributes organization].include?(p) }
else
params[:invoicing_profile_attributes].reject! { |p| p == 'organization' }
if params[:invoicing_profile_attributes] && params[:invoicing_profile_attributes][:organization]
if params[:invoicing_profile_attributes][:organization] == 'false'
params[:invoicing_profile_attributes].reject! { |p| %w[organization_attributes organization].include?(p) }
else
params[:invoicing_profile_attributes].reject! { |p| p == 'organization' }
end
end
not_complete = member.need_completion?

View File

@ -100,4 +100,23 @@ class MembersTest < ActionDispatch::IntegrationTest
assert_match(/Kevin/, res[0][:name])
end
test 'admin changes the group of a member' do
user = User.find(2)
patch "/api/members/#{user.id}/",
params: {
user: {
id: user.id,
group_id: 2
}
}
# Check response format & status
assert_equal 200, response.status, response.body
assert_equal Mime[:json], response.content_type
# Check search result
res = json_response(response.body)
assert_equal 2, res[:group_id]
end
end