populate userProfile in more places

This commit is contained in:
Hazelnoot 2025-06-06 02:48:49 -04:00
parent bd8cd8c4e4
commit c9884a74fc
2 changed files with 21 additions and 6 deletions

View file

@ -589,9 +589,24 @@ export class NoteEntityService implements OnModuleInit {
id: In(targetNotesToFetch),
},
relations: {
user: true,
reply: true,
renote: true,
user: {
userProfile: true,
},
reply: {
user: {
userProfile: true,
},
},
renote: {
user: {
userProfile: true,
},
reply: {
user: {
userProfile: true,
},
},
},
channel: true,
},
});

View file

@ -789,11 +789,11 @@ export class UserEntityService implements OnModuleInit {
.map(user => user.host)
.filter((host): host is string => host != null));
const _profiles: MiUserProfile[] = [];
const _profilesFromUsers: MiUserProfile[] = [];
const _profilesToFetch: string[] = [];
for (const user of _users) {
if (user.userProfile) {
_profiles.push(user.userProfile);
_profilesFromUsers.push(user.userProfile);
} else {
_profilesToFetch.push(user.id);
}
@ -805,7 +805,7 @@ export class UserEntityService implements OnModuleInit {
// profilesMap
this.cacheService.getUserProfiles(_profilesToFetch)
.then(profiles => {
for (const profile of _profiles) {
for (const profile of _profilesFromUsers) {
profiles.set(profile.userId, profile);
}
return profiles;