From fea7889e0cd5ed223a4db9cb668be684cead2a52 Mon Sep 17 00:00:00 2001 From: Marie Date: Thu, 17 Oct 2024 21:56:43 +0200 Subject: [PATCH] upd: add recommended checks --- .../src/server/api/endpoints/admin/decline-user.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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 2f127b0cd9..0a75dd977d 100644 --- a/packages/backend/src/server/api/endpoints/admin/decline-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/decline-user.ts @@ -45,6 +45,14 @@ export default class extends Endpoint { // eslint- throw new Error('user not found or already deleted'); } + if (user.approved) { + throw new Error('user is already approved'); + } + + if (user.host) { + throw new Error('user is not local'); + } + const profile = await this.userProfilesRepository.findOneBy({ userId: ps.userId }); if (profile?.email) {