fix: resolve toPid to local pid if able

This commit is contained in:
Julian Lam
2024-03-14 00:17:45 -04:00
parent c346177bb9
commit ebd750b4c7

View File

@@ -82,7 +82,7 @@ Mocks.post = async (objects) => {
return null; return null;
} }
const { let {
id: pid, id: pid,
attributedTo: uid, attributedTo: uid,
inReplyTo: toPid, inReplyTo: toPid,
@@ -91,6 +91,10 @@ Mocks.post = async (objects) => {
// conversation, // mastodon-specific, ignored. // conversation, // mastodon-specific, ignored.
} = object; } = object;
const resolved = await activitypub.helpers.resolveLocalId(toPid);
if (resolved.type === 'post') {
toPid = resolved.id;
}
const timestamp = new Date(published).getTime(); const timestamp = new Date(published).getTime();
let edited = new Date(updated); let edited = new Date(updated);
edited = Number.isNaN(edited.valueOf()) ? undefined : edited; edited = Number.isNaN(edited.valueOf()) ? undefined : edited;