mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
[bug] when an admin logs on the subscription page, his view is broken
Also: Prevent admins from leaving their dedicated group
This commit is contained in:
parent
54a5a2def7
commit
7e1edef8a0
@ -1,5 +1,8 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Prevent admins from leaving their dedicated group
|
||||
- Fix a bug: when an admin logs on the subscription page, his view is broken
|
||||
|
||||
## v4.4.1 2020 May 12
|
||||
|
||||
- Prevent VersionCheckWorker from polluting the sidekiq stack in development
|
||||
|
@ -197,10 +197,10 @@ Application.Controllers.controller('PlansIndexController', ['$scope', '$rootScop
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on('devise:new-session', function (event, user) { $scope.ctrl.member = user; });
|
||||
$scope.$on('devise:new-session', function (event, user) { if (user.role !== 'admin') { $scope.ctrl.member = user; } });
|
||||
|
||||
// watch when a coupon is applied to re-compute the total price
|
||||
return $scope.$watch('coupon.applied', function (newValue, oldValue) {
|
||||
$scope.$watch('coupon.applied', function (newValue, oldValue) {
|
||||
if ((newValue !== null) || (oldValue !== null)) {
|
||||
return updateCartPrice();
|
||||
}
|
||||
|
@ -15,6 +15,12 @@ class Members::MembersService
|
||||
return false
|
||||
end
|
||||
|
||||
if params[:group_id] && params[:group_id].to_i != Group.find_by(slug: 'admins').id && @member.admin?
|
||||
# an admin cannot change his group
|
||||
@member.errors.add(:group_id, I18n.t('members.admins_cant_change_group'))
|
||||
return false
|
||||
end
|
||||
|
||||
not_complete = member.need_completion?
|
||||
up_result = member.update(params)
|
||||
|
||||
|
@ -53,6 +53,7 @@ en:
|
||||
#members management
|
||||
members:
|
||||
unable_to_change_the_group_while_a_subscription_is_running: "Unable to change the group while a subscription is running"
|
||||
admins_cant_change_group: "Unable to remove an administrator from his dedicated group"
|
||||
please_input_the_authentication_code_sent_to_the_address: "Please input the authentication code sent to the e-mail address %{EMAIL}"
|
||||
your_authentication_code_is_not_valid: "Your authentication code is not valid."
|
||||
current_authentication_method_no_code: "The current authentication method does not require any migration code"
|
||||
|
Loading…
x
Reference in New Issue
Block a user