fix(UserEntityService): meProfile fetch problem
This commit is contained in:
parent
9319fa3bc7
commit
6bc715847d
1 changed files with 3 additions and 3 deletions
|
@ -412,13 +412,13 @@ export class UserEntityService implements OnModuleInit {
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
|
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
|
||||||
const meObject = await this.usersRepository.findOneByOrFail({ id: me?.id });
|
|
||||||
const meProfile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
|
||||||
|
|
||||||
const isDetailed = opts.schema !== 'UserLite';
|
const isDetailed = opts.schema !== 'UserLite';
|
||||||
const meId = me ? me.id : null;
|
const meId = me ? me.id : null;
|
||||||
const isMe = meId === user.id;
|
const isMe = meId === user.id;
|
||||||
const iAmModerator = me ? (await this.roleService.isModerator(me as MiUser)) && !meObject.isVacation && meProfile.twoFactorEnabled : false;
|
const meObject = await this.usersRepository.findOneBy({ id: me?.id });
|
||||||
|
const meProfile = await this.userProfilesRepository.findOneBy({ userId: me?.id });
|
||||||
|
const iAmModerator = me ? (await this.roleService.isModerator(me as MiUser)) && !meObject?.isVacation && meProfile?.twoFactorEnabled : false;
|
||||||
if (user.isSuspended && !iAmModerator) throw new IdentifiableError('85ab9bd7-3a41-4530-959d-f07073900109', `User ${user.id} has been suspended.`);
|
if (user.isSuspended && !iAmModerator) throw new IdentifiableError('85ab9bd7-3a41-4530-959d-f07073900109', `User ${user.id} has been suspended.`);
|
||||||
|
|
||||||
const profile = isDetailed
|
const profile = isDetailed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue