From 2996180c606a184ded131db380b5978880d76e7f Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 23 Mar 2021 13:47:30 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20limits=20not=20allowing?= =?UTF-8?q?=20contributors=20to=20be=20unsuspended?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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! --- core/server/models/user.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/server/models/user.js b/core/server/models/user.js index 458ff4d50a..f84739d812 100644 --- a/core/server/models/user.js +++ b/core/server/models/user.js @@ -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'); }