Node.js based forum software built for the modern web
test: fix tests
Julian Lambb00277ec1c0
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.jsindex e9db731ddf..81fb718da4 100644--- a/src/activitypub/inbox.js+++ b/src/activitypub/inbox.js@@ -577,7 +577,7 @@ inbox.announce = async (req) => {switch(true) {case object.type === 'Like': {- if (!cid) {+ if (!cid && !fromRelay) {return;}@@ -602,7 +602,7 @@ inbox.announce = async (req) => {}case object.type === 'Update': {- if (!cid) {+ if (!cid && !fromRelay) {return;}@@ -612,7 +612,7 @@ inbox.announce = async (req) => {}case object.type === 'Delete': {- if (!cid) {+ if (!cid && !fromRelay) {return;}@@ -660,7 +660,7 @@ inbox.announce = async (req) => {}case object.type === 'Create': {- if (!cid) {+ if (!cid && !fromRelay) {return;}diff --git a/test/activitypub/inbox.js b/test/activitypub/inbox.jsindex 04a12987fe..53f69ee79d 100644--- a/test/activitypub/inbox.js+++ b/test/activitypub/inbox.js@@ -534,8 +534,10 @@ describe('Inbox', () => {describe('(Like)', () => {it('should upvote a local post', async () => {const uid = await user.create({ username: utils.generateUUID().slice(0, 10) });+ const { id: actor, actor: groupActor } = helpers.mocks.group();+ await activitypub.actors.assertGroup(actor);const { postData } = await topics.post({- cid,+ cid: actor,uid,title: utils.generateUUID(),content: utils.generateUUID(),@@ -545,6 +547,7 @@ describe('Inbox', () => {object: `${nconf.get('url')}/post/${postData.pid}`,});const { activity } = helpers.mocks.announce({+ actor,object: like,});@@ -557,12 +560,17 @@ describe('Inbox', () => {});it('should upvote an asserted remote post', async () => {- const { id } = helpers.mocks.note();- await activitypub.notes.assert(0, id, { skipChecks: true });+ const { id: actor, actor: groupActor } = helpers.mocks.group();+ await activitypub.actors.assertGroup(actor);+ const { id, note } = helpers.mocks.note({+ audience: actor,+ });+ const assertion = await activitypub.notes.assert(0, id, { skipChecks: true });const { activity: like } = helpers.mocks.like({object: id,});const { activity } = helpers.mocks.announce({+ actor,object: like,});@@ -579,11 +587,19 @@ describe('Inbox', () => {describe('(Update)', () => {it('should update a note\'s content', async () => {const { id: actor } = helpers.mocks.person();- const { id, note } = helpers.mocks.note({ attributedTo: actor });+ const { id: groupActor } = helpers.mocks.group();+ await activitypub.actors.assertGroup(actor);+ const { id, note } = helpers.mocks.note({+ attributedTo: actor,+ audience: groupActor,+ });await activitypub.notes.assert(0, id, { skipChecks: true });note.content = utils.generateUUID();const { activity: update } = helpers.mocks.update({ object: note });- const { activity } = helpers.mocks.announce({ object: update });+ const { activity } = helpers.mocks.announce({+ actor: groupActor,+ object: update,+ });await activitypub.inbox.announce({ body: activity });