Node.js based forum software built for the modern web
fix: tests
Julian Lam4b2495b5aa9a
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.jsindex 73ba0b0964..38bfee26ce 100644--- a/src/activitypub/inbox.js+++ b/src/activitypub/inbox.js@@ -27,7 +27,7 @@ inbox.create = async (req) => {}const tid = await activitypub.notes.assertTopic(0, object.id);- winston.info(`[activitypub/inbox] Parsing note ${object.id} into topic ${tid}`);+ winston.verbose(`[activitypub/inbox] Parsing note ${object.id} into topic ${tid}`);};inbox.update = async (req) => {@@ -47,7 +47,7 @@ inbox.update = async (req) => {privileges.posts.can('posts:edit', object.id, activitypub._constants.uid),]);if (!exists || !allowed) {- winston.info(`[activitypub/inbox.update] ${object.id} not allowed to be edited.`);+ winston.warn(`[activitypub/inbox.update] ${object.id} not allowed to be edited.`);return activitypub.send('uid', 0, actor, {type: 'Reject',object: {@@ -62,7 +62,7 @@ inbox.update = async (req) => {if (postData) {await activitypub.notes.assert(0, [postData], { update: true });- winston.info(`[activitypub/inbox.update] Updating note ${postData.pid}`);+ winston.verbose(`[activitypub/inbox.update] Updating note ${postData.pid}`);} else {winston.warn(`[activitypub/inbox.update] Received note did not parse properly (id: ${object.id})`);}diff --git a/src/topics/create.js b/src/topics/create.jsindex fc12465b54..6f10c950c2 100644--- a/src/topics/create.js+++ b/src/topics/create.js@@ -82,7 +82,7 @@ module.exports = function (Topics) {const { uid } = data;const [categoryExists, canCreate, canTag, isAdmin] = await Promise.all([- categories.exists(data.cid),+ parseInt(data.cid, 10) > 0 ? categories.exists(data.cid) : true,privileges.categories.can('topics:create', data.cid, uid),privileges.categories.can('topics:tag', data.cid, uid),privileges.users.isAdministrator(uid),diff --git a/test/activitypub.js b/test/activitypub.jsindex 857b2a86a9..55aa288139 100644--- a/test/activitypub.js+++ b/test/activitypub.js@@ -455,6 +455,20 @@ describe('ActivityPub integration', () => {mediaType: 'text/markdown',},};+ const remoteUser = {+ '@context': 'https://www.w3.org/ns/activitystreams',+ id: 'https://example.org/user/foobar',+ url: 'https://example.org/user/foobar',++ type: 'Person',+ name: 'Foo Bar',+ preferredUsername: 'foobar',+ publicKey: {+ id: 'https://example.org/user/foobar#key',+ owner: 'https://example.org/user/foobar',+ publicKeyPem: 'publickey',+ },+ };let topic;@@ -462,6 +476,7 @@ describe('ActivityPub integration', () => {const controllers = require('../src/controllers');activitypub._cache.set(`0;${id}`, remoteNote);+ activitypub._cache.set(`0;https://example.org/user/foobar`, remoteUser);await controllers.activitypub.postInbox({body: {type: 'Create',