diff --git a/CHANGELOG.md b/CHANGELOG.md index d3dbd7c67..9dfc6619e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab-manager - Fix a bug: the subscription page is not available +- Fix a bug: users promoted to the administrator role are not in the admin group ## v4.4.0 2020 May 12 diff --git a/app/assets/javascripts/directives/cart.js.erb b/app/assets/javascripts/directives/cart.js.erb index eb927e229..35fb70539 100644 --- a/app/assets/javascripts/directives/cart.js.erb +++ b/app/assets/javascripts/directives/cart.js.erb @@ -118,7 +118,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', * Switch the user's view from the reservation agenda to the plan subscription */ $scope.showPlans = function () { - // first, we ensure that a user was selected (admin) or logged (member) + // first, we ensure that a user was selected (admin/manager) or logged (member) const isSelectedUser = Object.keys($scope.user).length > 0; // all slots are in future const areFutureSlots = _.every($scope.events.reserved, function(s) { diff --git a/app/controllers/api/members_controller.rb b/app/controllers/api/members_controller.rb index 9d7ea4afb..a8a25a3e5 100644 --- a/app/controllers/api/members_controller.rb +++ b/app/controllers/api/members_controller.rb @@ -219,6 +219,9 @@ class API::MembersController < API::ApiController @member.remove_role ex_role @member.add_role params[:role] + # if the new role is 'admin', then change the group to the admins group + @member.update_attributes(group_id: Group.find_by(slug: 'admins').id) if params[:role] == 'admin' + NotificationCenter.call type: 'notify_user_role_update', receiver: @member, attached_object: @member