Fixes: Error when user is suspended by deleted user

Fixes: Suspended user interface never displayed
This commit is contained in:
Tom Moor
2019-02-15 21:49:48 -08:00
parent fdb49cf153
commit 346ea4df89
3 changed files with 10 additions and 5 deletions

View File

@@ -80,7 +80,10 @@ export default function auth(options?: { required?: boolean } = {}) {
}
if (user.isSuspended) {
const suspendingAdmin = await User.findById(user.suspendedById);
const suspendingAdmin = await User.findOne({
where: { id: user.suspendedById },
paranoid: false,
});
throw new UserSuspendedError({ adminEmail: suspendingAdmin.email });
}