Skip to content

Commit 51b7e75

Browse files
committed
allow invitation if only free users
1 parent fafff22 commit 51b7e75

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/actions/inviteToWorkspace.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ module.exports = async function inviteToWorkspace(params) {
4848
if (inviterRoles == null || (!inviterRoles.includes('admin') && !inviterRoles.includes('owner'))) {
4949
throw new Error('Forbidden');
5050
}
51-
if (workspace.subscriptionTier !== 'pro') {
51+
const users = await User.find({ _id: { $in: workspace.members.map(member => member.userId) } });
52+
const numPaidUsers = users.filter(user => !user.isFreeUser).length;
53+
if (workspace.subscriptionTier !== 'pro' && numPaidUsers > 0) {
5254
throw new Error('Cannot invite user without creating a subscription');
5355
}
5456

0 commit comments

Comments
 (0)