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,
|
||||
});
|
||||
|
||||
// Resolve recipient for delivery
|
||||
const { resolveAuthor } = await import("../resolve-author.js");
|
||||
// Look up the recipient actor directly (senderActorUrl is an actor URL, not a post URL)
|
||||
const documentLoader = await ctx.getDocumentLoader({ identifier: handle });
|
||||
const recipient = await resolveAuthor(
|
||||
senderActorUrl,
|
||||
ctx,
|
||||
documentLoader,
|
||||
application?.collections,
|
||||
);
|
||||
let recipient;
|
||||
try {
|
||||
recipient = await ctx.lookupObject(new URL(senderActorUrl), { documentLoader });
|
||||
} catch (lookupError) {
|
||||
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, {
|
||||
orderingKey: noteId.href,
|
||||
});
|
||||
console.info(`[ActivityPub] Sent direct AP reply to ${senderActorUrl}`);
|
||||
}
|
||||
|
||||
return response.redirect(`${mountPath}/admin/reader/notifications`);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user