diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 0154af5b77..b2f3d125ea 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -121,8 +121,15 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { tid = tid || utils.generateUUID(); mainPost.tid = tid; + const urlMap = chain.reduce((map, post) => (post.url ? map.set(post.url, post.id) : map), new Map()); const unprocessed = chain.map((post) => { post.tid = tid; // add tid to post hash + + // Ensure toPids in replies are ids + if (urlMap.has(post.toPid)) { + post.toPid = urlMap.get(post.toPid); + } + return post; }).filter((p, idx) => !members[idx]); const count = unprocessed.length;