fix: deep clone activity prop before execution; feps.announce

This commit is contained in:
Julian Lam
2025-12-02 13:42:06 -05:00
parent 8236b594af
commit 977a67f4cd
2 changed files with 2 additions and 3 deletions

View File

@@ -10,6 +10,8 @@ const activitypub = module.parent.exports;
const Feps = module.exports;
Feps.announce = async function announce(id, activity) {
activity = structuredClone(activity);
let localId;
if (String(id).startsWith(nconf.get('url'))) {
({ id: localId } = await activitypub.helpers.resolveLocalId(id));

View File

@@ -163,10 +163,8 @@ describe('FEPs', () => {
cc: [`${nconf.get('url')}/category/${cid}`],
});
pid = id;
console.log('note passed to mocks.create', note);
({ activity } = await helpers.mocks.create(note));
console.log('activity passed to inbox.create', activity);
await activitypub.inbox.create({ body: activity });
const activities = Array.from(activitypub._sent);
@@ -183,7 +181,6 @@ describe('FEPs', () => {
return activity.type === 'Announce' &&
activity.object && activity.object.type === 'Note';
});
console.log('activities', JSON.stringify(activities, null, 2));
assert(test1 && test2);
});