0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 Fixed limits not allowing contributors to be unsuspended

refs https://github.com/TryGhost/Team/issues/510

- contributors don't count towards the staff limit, therefore they should be allowed to be unsuspended
- currently, we don't check the role when unsuspending, which is incorrect
- this bug is pure oversight!
This commit is contained in:
Hannah Wolfe 2021-03-23 13:47:30 +00:00
parent 0242e5e48b
commit 2996180c60

View file

@ -710,8 +710,10 @@ User = ghostBookshelf.Model.extend({
});
}
// If we have a staff user limit & the user is being unsuspended
if (limitService.isLimited('staff') && action === 'edit' && unsafeAttrs.status && unsafeAttrs.status === 'active' && userModel.get('status') === 'inactive') {
const isUnsuspending = unsafeAttrs.status && unsafeAttrs.status === 'active' && userModel.get('status') === 'inactive';
// If we have a staff user limit & the staff user is being unsuspended (don't count contributors)
if (limitService.isLimited('staff') && action === 'edit' && isUnsuspending && !userModel.hasRole('Contributor')) {
await limitService.errorIfWouldGoOverLimit('staff');
}