From c3f768181ae232a9ac03c69759f5508398b4cd55 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Thu, 19 Oct 2023 10:42:18 +0200 Subject: [PATCH] fix: invite code not being marked as used Fixes an issue where if approval and invite were enabled the code would stay as unused --- packages/backend/src/server/api/SignupApiService.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts index 418656fdbc..c07389d975 100644 --- a/packages/backend/src/server/api/SignupApiService.ts +++ b/packages/backend/src/server/api/SignupApiService.ts @@ -199,7 +199,7 @@ export class SignupApiService { reply.code(204); return; } else if (instance.approvalRequiredForSignup) { - await this.signupService.signup({ + const { account } = await this.signupService.signup({ username, password, host, reason, }); @@ -209,6 +209,14 @@ export class SignupApiService { 'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.'); } + if (ticket) { + await this.registrationTicketsRepository.update(ticket.id, { + usedAt: new Date(), + usedBy: account, + usedById: account.id, + }); + } + reply.code(204); return; } else {