summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-06-01 00:25:53 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-06-01 00:25:53 -0400
commita5857d27244e513b3d1055d70e9e66c26dc7fbd8 (patch)
tree93ac71c58bfe38d32a4265b3e01febe893cbf5eb /packages/backend/src/server/api
parentreturn typed relations from MastodonDataService note fetchers (diff)
downloadsharkey-a5857d27244e513b3d1055d70e9e66c26dc7fbd8.tar.gz
sharkey-a5857d27244e513b3d1055d70e9e66c26dc7fbd8.tar.bz2
sharkey-a5857d27244e513b3d1055d70e9e66c26dc7fbd8.zip
allow passing user/note into convertStatus for performance
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/mastodon/MastodonConverters.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/backend/src/server/api/mastodon/MastodonConverters.ts b/packages/backend/src/server/api/mastodon/MastodonConverters.ts
index 375ea1ef08..02ce31c4f8 100644
--- a/packages/backend/src/server/api/mastodon/MastodonConverters.ts
+++ b/packages/backend/src/server/api/mastodon/MastodonConverters.ts
@@ -252,10 +252,10 @@ export class MastodonConverters {
return await this.convertStatus(status, me);
}
- public async convertStatus(status: Entity.Status, me: MiLocalUser | null): Promise<MastodonEntity.Status> {
+ public async convertStatus(status: Entity.Status, me: MiLocalUser | null, hints?: { note?: MiNote, user?: MiUser }): Promise<MastodonEntity.Status> {
const convertedAccount = this.convertAccount(status.account);
- const note = await this.mastodonDataService.requireNote(status.id, me);
- const noteUser = await this.getUser(status.account.id);
+ const note = hints?.note ?? await this.mastodonDataService.requireNote(status.id, me);
+ const noteUser = hints?.user ?? note.user ?? await this.getUser(status.account.id);
const mentionedRemoteUsers = JSON.parse(note.mentionedRemoteUsers);
const emojis = await this.customEmojiService.populateEmojis(note.emojis, noteUser.host ? noteUser.host : this.config.host);