summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-06-06 02:48:49 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-06-09 11:02:36 -0400
commitc9884a74fc5038d35652d02c78a2672be15b7a57 (patch)
tree4e84961f344ecbd4a3d1fdbcb5f4ae647a529d4c /packages/backend/src/core
parentuse more bulk hints in NoteEntityService / UserEntityService, and run the pac... (diff)
downloadsharkey-c9884a74fc5038d35652d02c78a2672be15b7a57.tar.gz
sharkey-c9884a74fc5038d35652d02c78a2672be15b7a57.tar.bz2
sharkey-c9884a74fc5038d35652d02c78a2672be15b7a57.zip
populate userProfile in more places
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/entities/NoteEntityService.ts21
-rw-r--r--packages/backend/src/core/entities/UserEntityService.ts6
2 files changed, 21 insertions, 6 deletions
diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts
index 7ddf0abc3e..327b702e7e 100644
--- a/packages/backend/src/core/entities/NoteEntityService.ts
+++ b/packages/backend/src/core/entities/NoteEntityService.ts
@@ -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,
},
});
diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts
index 7e3a55e155..84b6a4a021 100644
--- a/packages/backend/src/core/entities/UserEntityService.ts
+++ b/packages/backend/src/core/entities/UserEntityService.ts
@@ -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;