fix: use ctx.lookupObject for DM recipient instead of resolveAuthor (actor URL, not post URL)
This commit is contained in:
+15
-10
@@ -264,22 +264,27 @@ export function submitComposeController(mountPath, plugin) {
|
|||||||
object: note,
|
object: note,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Resolve recipient for delivery
|
// Look up the recipient actor directly (senderActorUrl is an actor URL, not a post URL)
|
||||||
const { resolveAuthor } = await import("../resolve-author.js");
|
|
||||||
const documentLoader = await ctx.getDocumentLoader({ identifier: handle });
|
const documentLoader = await ctx.getDocumentLoader({ identifier: handle });
|
||||||
const recipient = await resolveAuthor(
|
let recipient;
|
||||||
senderActorUrl,
|
try {
|
||||||
ctx,
|
recipient = await ctx.lookupObject(new URL(senderActorUrl), { documentLoader });
|
||||||
documentLoader,
|
} catch (lookupError) {
|
||||||
application?.collections,
|
console.warn(`[ActivityPub] Actor lookup failed for ${senderActorUrl}:`, lookupError.message);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
// Fall back to a minimal Recipient if lookup fails (standard inbox path)
|
||||||
|
if (!recipient) {
|
||||||
|
recipient = {
|
||||||
|
id: new URL(senderActorUrl),
|
||||||
|
inboxId: new URL(`${senderActorUrl}/inbox`),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (recipient) {
|
|
||||||
await ctx.sendActivity({ identifier: handle }, recipient, create, {
|
await ctx.sendActivity({ identifier: handle }, recipient, create, {
|
||||||
orderingKey: noteId.href,
|
orderingKey: noteId.href,
|
||||||
});
|
});
|
||||||
console.info(`[ActivityPub] Sent direct AP reply to ${senderActorUrl}`);
|
console.info(`[ActivityPub] Sent direct AP reply to ${senderActorUrl}`);
|
||||||
}
|
|
||||||
|
|
||||||
return response.redirect(`${mountPath}/admin/reader/notifications`);
|
return response.redirect(`${mountPath}/admin/reader/notifications`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user