Node.js based forum software built for the modern web
test: #13255, reply to topic in remote category addresses remote category
Julian Lam85e7c1a20d15
diff --git a/src/api/topics.js b/src/api/topics.jsindex 7a8ed44203..0155429ecc 100644--- a/src/api/topics.js+++ b/src/api/topics.js@@ -123,7 +123,7 @@ topicsAPI.reply = async function (caller, data) {}socketHelpers.notifyNew(caller.uid, 'newPost', result);- activitypubApi.create.note(caller, { post: postData });+ await activitypubApi.create.note(caller, { post: postData });return postData;};diff --git a/test/activitypub/notes.js b/test/activitypub/notes.jsindex 543fb255db..0bebb03927 100644--- a/test/activitypub/notes.js+++ b/test/activitypub/notes.js@@ -323,6 +323,42 @@ describe('Notes', () => {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));+ });+ });});});