1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-01 00:08:35 +09:00

Merge pull request #13816 from misskey-dev/develop

developにマージされた分の追いつき用
This commit is contained in:
syuilo 2024-05-10 21:33:20 +09:00 committed by GitHub
commit 6046ba1841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -249,20 +249,41 @@ export class UserEntityService implements OnModuleInit {
] = await Promise.all([ ] = await Promise.all([
this.followingsRepository.findBy({ followerId: me }) this.followingsRepository.findBy({ followerId: me })
.then(f => new Map(f.map(it => [it.followeeId, it]))), .then(f => new Map(f.map(it => [it.followeeId, it]))),
this.followingsRepository.findBy({ followeeId: me }) this.followingsRepository.createQueryBuilder('f')
.then(it => it.map(it => it.followerId)), .select('f.followerId')
this.followRequestsRepository.findBy({ followerId: me }) .where('f.followeeId = :me', { me })
.then(it => it.map(it => it.followeeId)), .getRawMany<{ f_followerId: string }>()
this.followRequestsRepository.findBy({ followeeId: me }) .then(it => it.map(it => it.f_followerId)),
.then(it => it.map(it => it.followerId)), this.followRequestsRepository.createQueryBuilder('f')
this.blockingsRepository.findBy({ blockerId: me }) .select('f.followeeId')
.then(it => it.map(it => it.blockeeId)), .where('f.followerId = :me', { me })
this.blockingsRepository.findBy({ blockeeId: me }) .getRawMany<{ f_followeeId: string }>()
.then(it => it.map(it => it.blockerId)), .then(it => it.map(it => it.f_followeeId)),
this.mutingsRepository.findBy({ muterId: me }) this.followRequestsRepository.createQueryBuilder('f')
.then(it => it.map(it => it.muteeId)), .select('f.followerId')
this.renoteMutingsRepository.findBy({ muterId: me }) .where('f.followeeId = :me', { me })
.then(it => it.map(it => it.muteeId)), .getRawMany<{ f_followerId: string }>()
.then(it => it.map(it => it.f_followerId)),
this.blockingsRepository.createQueryBuilder('b')
.select('b.blockeeId')
.where('b.blockerId = :me', { me })
.getRawMany<{ b_blockeeId: string }>()
.then(it => it.map(it => it.b_blockeeId)),
this.blockingsRepository.createQueryBuilder('b')
.select('b.blockerId')
.where('b.blockeeId = :me', { me })
.getRawMany<{ b_blockerId: string }>()
.then(it => it.map(it => it.b_blockerId)),
this.mutingsRepository.createQueryBuilder('m')
.select('m.muteeId')
.where('m.muterId = :me', { me })
.getRawMany<{ m_muteeId: string }>()
.then(it => it.map(it => it.m_muteeId)),
this.renoteMutingsRepository.createQueryBuilder('m')
.select('m.muteeId')
.where('m.muterId = :me', { me })
.getRawMany<{ m_muteeId: string }>()
.then(it => it.map(it => it.m_muteeId)),
]); ]);
return new Map( return new Map(
@ -637,18 +658,17 @@ export class UserEntityService implements OnModuleInit {
} }
const _userIds = _users.map(u => u.id); const _userIds = _users.map(u => u.id);
// -- 特に前提条件のない値群を取得
const profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
// -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得 // -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得
let profilesMap: Map<MiUser['id'], MiUserProfile> = new Map();
let userRelations: Map<MiUser['id'], UserRelation> = new Map(); let userRelations: Map<MiUser['id'], UserRelation> = new Map();
let userMemos: Map<MiUser['id'], string | null> = new Map(); let userMemos: Map<MiUser['id'], string | null> = new Map();
let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map(); let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map();
if (options?.schema !== 'UserLite') { if (options?.schema !== 'UserLite') {
profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
const meId = me ? me.id : null; const meId = me ? me.id : null;
if (meId) { if (meId) {
userMemos = await this.userMemosRepository.findBy({ userId: meId }) userMemos = await this.userMemosRepository.findBy({ userId: meId })