fix: broadcastActorUpdate was silently failing due to Fedify API mismatch

ctx.getActor() only exists on RequestContext (inside HTTP handlers), not
on the base Context returned by createContext(). Extracted actor-building
logic into shared buildPersonActor() helper used by both the dispatcher
and broadcastActorUpdate(). Profile link attachments now propagate to
remote instances via Update(Person) activity.
This commit is contained in:
Ricardo
2026-02-22 11:27:35 +01:00
parent 0fa446ceb2
commit c648606525
4 changed files with 98 additions and 75 deletions

View File

@@ -1,6 +1,6 @@
import express from "express";
import { setupFederation } from "./lib/federation-setup.js";
import { setupFederation, buildPersonActor } from "./lib/federation-setup.js";
import {
createFedifyMiddleware,
} from "./lib/federation-bridge.js";
@@ -690,9 +690,15 @@ export default class ActivityPubEndpoint {
{ handle, publicationUrl: this._publicationUrl },
);
// Retrieve the full actor from the dispatcher (same object remote
// servers will get when they re-fetch the actor URL)
const actor = await ctx.getActor(handle);
// Build the full actor object (same as what the dispatcher serves).
// Note: ctx.getActor() only exists on RequestContext, not the base
// Context returned by createContext(), so we use the shared helper.
const actor = await buildPersonActor(
ctx,
handle,
this._collections,
this.options.actorType,
);
if (!actor) {
console.warn("[ActivityPub] broadcastActorUpdate: could not build actor");
return;