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