mirror of
https://github.com/svemagie/indiekit-endpoint-activitypub.git
synced 2026-04-02 15:44:58 +02:00
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:
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user