diff --git a/ghost/limit-service/lib/config.js b/ghost/limit-service/lib/config.js index 1835441a40..66c1e9e75a 100644 --- a/ghost/limit-service/lib/config.js +++ b/ghost/limit-service/lib/config.js @@ -8,12 +8,17 @@ module.exports = { staff: { currentCountQuery: async (db) => { let result = await db.knex('users') - .count('users.id', {as: 'count'}) + .select('users.id') .leftJoin('roles_users', 'users.id', 'roles_users.user_id') .leftJoin('roles', 'roles_users.role_id', 'roles.id') - .whereNot('roles.name', 'Contributor').andWhereNot('users.status', 'inactive').first(); + .whereNot('roles.name', 'Contributor').andWhereNot('users.status', 'inactive').union([ + db.knex('invites') + .select('invites.id') + .leftJoin('roles', 'invites.role_id', 'roles.id') + .whereNot('roles.name', 'Contributor') + ]); - return result.count; + return result.length; } }, custom_integrations: {