Skip to content

Commit

Permalink
fix(backend): user.memoはdetailがtrueな時だけに
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Apr 13, 2023
1 parent 97abfd4 commit 5cac151
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/backend/src/core/entities/UserEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 ? {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5cac151

Please sign in to comment.