From 42530b5a39f0bce386bf408004d1584bf7a36576 Mon Sep 17 00:00:00 2001 From: Marie Date: Thu, 17 Oct 2024 20:15:20 +0200 Subject: [PATCH] upd: add additional check from delete endpoint --- .../backend/src/server/api/endpoints/admin/decline-user.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/decline-user.ts b/packages/backend/src/server/api/endpoints/admin/decline-user.ts index a8246a1ee7..2f127b0cd9 100644 --- a/packages/backend/src/server/api/endpoints/admin/decline-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/decline-user.ts @@ -35,14 +35,14 @@ export default class extends Endpoint { // eslint- private usedUsernamesRepository: UsedUsernamesRepository, private moderationLogService: ModerationLogService, - private emailService: EmailService, + private emailService: EmailService, private deleteAccountService: DeleteAccountService, ) { super(meta, paramDef, async (ps, me) => { const user = await this.usersRepository.findOneBy({ id: ps.userId }); - if (user == null) { - throw new Error('user not found'); + if (user == null || user.isDeleted) { + throw new Error('user not found or already deleted'); } const profile = await this.userProfilesRepository.findOneBy({ userId: ps.userId });