prevent suspending a user who is already suspended
This commit is contained in:
parent
69f3c8a58e
commit
7581b5b40b
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue