2
0

🚑 Fix can invite new members in workspace bool

Closes #964
This commit is contained in:
Baptiste Arnaud
2023-10-25 17:57:13 +02:00
parent 4b248d554f
commit 53558dc303
6 changed files with 19 additions and 13 deletions

View File

@ -13,7 +13,7 @@ export const getChatsLimit = ({
plan === Plan.LIFETIME ||
plan === Plan.OFFERED
)
return -1
if (plan === Plan.CUSTOM) return customChatsLimit ?? -1
return 'inf'
if (plan === Plan.CUSTOM) return customChatsLimit ?? 'inf'
return chatsLimits[plan]
}

View File

@ -6,7 +6,7 @@ export const getSeatsLimit = ({
plan,
customSeatsLimit,
}: Pick<Workspace, 'plan' | 'customSeatsLimit'>) => {
if (plan === Plan.UNLIMITED) return -1
if (plan === Plan.CUSTOM) return customSeatsLimit ? customSeatsLimit : -1
if (plan === Plan.UNLIMITED) return 'inf'
if (plan === Plan.CUSTOM) return customSeatsLimit ? customSeatsLimit : 'inf'
return seatsLimits[plan]
}

View File

@ -110,6 +110,7 @@ export const checkAndReportChatsUsage = async () => {
workspaceId: result.workspace.id,
subscription,
})
if (chatsLimit === 'inf') continue
if (
chatsLimit > 0 &&
totalChatsUsed >= chatsLimit * LIMIT_EMAIL_TRIGGER_PERCENT &&