enhance(backend/frontend): モデレーションノートをユーザーのプロフィールページからも閲覧および編集できるように

This commit is contained in:
syuilo 2023-05-06 09:51:06 +09:00
parent bd1c2abffc
commit 10ff379b4c
3 changed files with 31 additions and 10 deletions

View file

@ -292,7 +292,7 @@ export class UserEntityService implements OnModuleInit {
public async pack<ExpectsMe extends boolean | null = null, D extends boolean = false>(
src: User['id'] | User,
me?: { id: User['id'] } | null | undefined,
me?: { id: User['id']; isRoot: boolean; } | null | undefined,
options?: {
detail?: D,
includeSecrets?: boolean,
@ -308,6 +308,7 @@ export class UserEntityService implements OnModuleInit {
const meId = me ? me.id : null;
const isMe = meId === user.id;
const iAmModerator = me ? await this.roleService.isModerator(me) : false;
const relation = meId && !isMe && opts.detail ? await this.getRelation(meId, user.id) : null;
const pins = opts.detail ? await this.userNotePiningsRepository.createQueryBuilder('pin')
@ -411,6 +412,7 @@ export class UserEntityService implements OnModuleInit {
userId: meId,
targetUserId: user.id,
}).then(row => row?.memo ?? null),
moderationNote: iAmModerator ? profile!.moderationNote : null,
} : {}),
...(opts.detail && isMe ? {