Skip to content

Commit

Permalink
Hydrated attributedTo property of Announce objects
Browse files Browse the repository at this point in the history
This is needed to render the original author of the object in the frontend
  • Loading branch information
allouis committed Aug 1, 2024
1 parent 0154746 commit bcc14f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dispatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ export async function handleAnnounce(

const objectJson = await object.toJsonLd();

if (typeof objectJson === 'object' && objectJson !== null) {
if ('attributedTo' in objectJson && typeof objectJson.attributedTo === 'string') {
const actor = await ctx.data.globaldb.get([objectJson.attributedTo]) ?? await lookupObject(objectJson.attributedTo)
objectJson.attributedTo = await (actor as any)?.toJsonLd();
}
}

ctx.data.globaldb.set([object.id.href], objectJson);
}

Expand Down

0 comments on commit bcc14f3

Please sign in to comment.