mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-21 15:03:12 +01:00
fix: deep clone activity prop before execution; feps.announce
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user