mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 09:36:16 +01:00
test: #13255, reply to topic in remote category addresses remote category
This commit is contained in:
@@ -123,7 +123,7 @@ topicsAPI.reply = async function (caller, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
socketHelpers.notifyNew(caller.uid, 'newPost', result);
|
socketHelpers.notifyNew(caller.uid, 'newPost', result);
|
||||||
activitypubApi.create.note(caller, { post: postData });
|
await activitypubApi.create.note(caller, { post: postData });
|
||||||
|
|
||||||
return postData;
|
return postData;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -323,6 +323,42 @@ describe('Notes', () => {
|
|||||||
assert(addressees.has(cid));
|
assert(addressees.has(cid));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('replies', () => {
|
||||||
|
it('should federate out a Create activity with the remote community addressed', async () => {
|
||||||
|
const { tid } = await api.topics.create({ uid }, {
|
||||||
|
cid,
|
||||||
|
title: utils.generateUUID(),
|
||||||
|
content: utils.generateUUID(),
|
||||||
|
});
|
||||||
|
|
||||||
|
activitypub._sent.clear();
|
||||||
|
|
||||||
|
const postData = await api.topics.reply({ uid }, {
|
||||||
|
tid,
|
||||||
|
content: utils.generateUUID(),
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(postData);
|
||||||
|
assert.strictEqual(activitypub._sent.size, 1);
|
||||||
|
|
||||||
|
const key = Array.from(activitypub._sent.keys())[0];
|
||||||
|
const activity = activitypub._sent.get(key);
|
||||||
|
assert(activity && activity.to);
|
||||||
|
assert.strictEqual(activity.type, 'Create');
|
||||||
|
|
||||||
|
const addressees = new Set([
|
||||||
|
...(activity.to || []),
|
||||||
|
...(activity.cc || []),
|
||||||
|
...(activity.bcc || []),
|
||||||
|
...(activity.object.to || []),
|
||||||
|
...(activity.object.cc || []),
|
||||||
|
...(activity.object.bcc || []),
|
||||||
|
]);
|
||||||
|
|
||||||
|
assert(addressees.has(cid));
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user