prevent suspending a user who is already suspended

This commit is contained in:
bunnybeam 2025-07-10 15:45:21 +01:00
parent 69f3c8a58e
commit 7581b5b40b
No known key found for this signature in database

View file

@ -42,10 +42,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new Error('user not found');
}
if (user.isSuspended) {
throw new Error('user already suspended');
}
if (await this.roleService.isModerator(user)) {
throw new Error('cannot suspend moderator account');
}
await this.userSuspendService.suspend(user, me);
});
}