fix(backend): user.memoはdetailがtrueな時だけに

This commit is contained in:
syuilo 2023-04-13 13:34:54 +09:00
parent 97abfd48ce
commit 5cac1515fd

View File

@ -340,11 +340,6 @@ export class UserEntityService implements OnModuleInit {
const falsy = opts.detail ? false : undefined;
const memo = meId == null ? null : await this.userMemosRepository.findOneBy({
userId: meId,
targetUserId: user.id,
}).then(row => row?.memo ?? null);
const packed = {
id: user.id,
name: user.name,
@ -417,6 +412,10 @@ export class UserEntityService implements OnModuleInit {
isAdministrator: role.isAdministrator,
displayOrder: role.displayOrder,
}))),
memo: meId == null ? null : await this.userMemosRepository.findOneBy({
userId: meId,
targetUserId: user.id,
}).then(row => row?.memo ?? null),
} : {}),
...(opts.detail && isMe ? {
@ -484,10 +483,6 @@ export class UserEntityService implements OnModuleInit {
isMuted: relation.isMuted,
isRenoteMuted: relation.isRenoteMuted,
} : {}),
...(memo ? {
memo,
} : {}),
} as Promiseable<Packed<'User'>> as Promiseable<IsMeAndIsUserDetailed<ExpectsMe, D>>;
return await awaitAll(packed);