fix: store actorAvatar in ap_activities for inbox interactions

Moved extractActorInfo() before logActivity() in Like, Announce, and
Reply handlers so the actor's avatar URL is persisted in ap_activities.
Previously only stored in ap_notifications, leaving conversation_items
without photos for non-followers.
This commit is contained in:
Ricardo
2026-02-26 15:00:07 +01:00
parent ef0887e0dd
commit 2c4ffeaba0
2 changed files with 14 additions and 4 deletions

View File

@@ -253,17 +253,20 @@ export function registerInboxListeners(inboxChain, options) {
actorObj?.preferredUsername?.toString() ||
actorUrl;
// Extract actor info (including avatar) before logging so we can store it
const actorInfo = await extractActorInfo(actorObj, { documentLoader: authLoader });
await logActivity(collections, storeRawActivities, {
direction: "inbound",
type: "Like",
actorUrl,
actorName,
actorAvatar: actorInfo.photo || "",
objectUrl: objectId,
summary: `${actorName} liked ${objectId}`,
});
// Store notification
const actorInfo = await extractActorInfo(actorObj, { documentLoader: authLoader });
await addNotification(collections, {
uid: like.id?.href || `like:${actorUrl}:${objectId}`,
type: "like",
@@ -301,18 +304,21 @@ export function registerInboxListeners(inboxChain, options) {
actorObj?.preferredUsername?.toString() ||
actorUrl;
// Extract actor info (including avatar) before logging so we can store it
const actorInfo = await extractActorInfo(actorObj, { documentLoader: authLoader });
// Log the boost activity
await logActivity(collections, storeRawActivities, {
direction: "inbound",
type: "Announce",
actorUrl,
actorName,
actorAvatar: actorInfo.photo || "",
objectUrl: objectId,
summary: `${actorName} boosted ${objectId}`,
});
// Create notification
const actorInfo = await extractActorInfo(actorObj, { documentLoader: authLoader });
await addNotification(collections, {
uid: announce.id?.href || `${actorUrl}#boost-${objectId}`,
type: "boost",
@@ -392,11 +398,16 @@ export function registerInboxListeners(inboxChain, options) {
const pubUrl = collections._publicationUrl;
if (inReplyTo) {
const content = object.content?.toString() || "";
// Extract actor info (including avatar) before logging so we can store it
const actorInfo = await extractActorInfo(actorObj, { documentLoader: authLoader });
await logActivity(collections, storeRawActivities, {
direction: "inbound",
type: "Reply",
actorUrl,
actorName,
actorAvatar: actorInfo.photo || "",
objectUrl: object.id?.href || "",
targetUrl: inReplyTo,
content,
@@ -405,7 +416,6 @@ export function registerInboxListeners(inboxChain, options) {
// Create notification if reply is to one of OUR posts
if (pubUrl && inReplyTo.startsWith(pubUrl)) {
const actorInfo = await extractActorInfo(actorObj, { documentLoader: authLoader });
const rawHtml = object.content?.toString() || "";
const contentHtml = sanitizeContent(rawHtml);
const contentText = rawHtml.replace(/<[^>]*>/g, "").substring(0, 200);

View File

@@ -1,6 +1,6 @@
{
"name": "@rmdes/indiekit-endpoint-activitypub",
"version": "2.0.26",
"version": "2.0.27",
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
"keywords": [
"indiekit",