Fix invite link sign-up with workspace without subcription and billing not enabled (#5006)

## Context

We recently introduced this verification but we didn't take into account
self-hosting that might not use billing.

## Test
tested locally with
- new workspace and new account
- existing workspace with new account and billing not enabled and status
incomplete => OK
- existing workspace with new account and billing enabled and status
incomplete => NOK
- existing workspace with new account and billing enabled and status
active => OK
This commit is contained in:
Weiko
2024-04-17 15:09:51 +02:00
committed by GitHub
parent 64cc6ecc3b
commit 6804a90f2f

View File

@ -132,12 +132,18 @@ export class SignInUpService {
}) {
const workspace = await this.workspaceRepository.findOneBy({
inviteHash: workspaceInviteHash,
subscriptionStatus: 'active',
});
assert(
workspace,
'This workspace inviteHash is invalid or the workspace is not active',
'This workspace inviteHash is invalid',
ForbiddenException,
);
assert(
!this.environmentService.get('IS_BILLING_ENABLED') ||
workspace.subscriptionStatus === 'active',
'Workspace subscription status needs to be active',
ForbiddenException,
);