mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 04:26:58 +00:00
populate userProfile in more places
This commit is contained in:
parent
bd8cd8c4e4
commit
c9884a74fc
2 changed files with 21 additions and 6 deletions
|
@ -589,9 +589,24 @@ export class NoteEntityService implements OnModuleInit {
|
||||||
id: In(targetNotesToFetch),
|
id: In(targetNotesToFetch),
|
||||||
},
|
},
|
||||||
relations: {
|
relations: {
|
||||||
user: true,
|
user: {
|
||||||
reply: true,
|
userProfile: true,
|
||||||
renote: true,
|
},
|
||||||
|
reply: {
|
||||||
|
user: {
|
||||||
|
userProfile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
renote: {
|
||||||
|
user: {
|
||||||
|
userProfile: true,
|
||||||
|
},
|
||||||
|
reply: {
|
||||||
|
user: {
|
||||||
|
userProfile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
channel: true,
|
channel: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -789,11 +789,11 @@ export class UserEntityService implements OnModuleInit {
|
||||||
.map(user => user.host)
|
.map(user => user.host)
|
||||||
.filter((host): host is string => host != null));
|
.filter((host): host is string => host != null));
|
||||||
|
|
||||||
const _profiles: MiUserProfile[] = [];
|
const _profilesFromUsers: MiUserProfile[] = [];
|
||||||
const _profilesToFetch: string[] = [];
|
const _profilesToFetch: string[] = [];
|
||||||
for (const user of _users) {
|
for (const user of _users) {
|
||||||
if (user.userProfile) {
|
if (user.userProfile) {
|
||||||
_profiles.push(user.userProfile);
|
_profilesFromUsers.push(user.userProfile);
|
||||||
} else {
|
} else {
|
||||||
_profilesToFetch.push(user.id);
|
_profilesToFetch.push(user.id);
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
// profilesMap
|
// profilesMap
|
||||||
this.cacheService.getUserProfiles(_profilesToFetch)
|
this.cacheService.getUserProfiles(_profilesToFetch)
|
||||||
.then(profiles => {
|
.then(profiles => {
|
||||||
for (const profile of _profiles) {
|
for (const profile of _profilesFromUsers) {
|
||||||
profiles.set(profile.userId, profile);
|
profiles.set(profile.userId, profile);
|
||||||
}
|
}
|
||||||
return profiles;
|
return profiles;
|
||||||
|
|
Loading…
Add table
Reference in a new issue