Node.js based forum software built for the modern web
refactor: remove Announce(Like) handler in favour of removing the wrapper and delegating to inbox.like directly (it has more checks). Preserve the actor assertion check as that is not done on sub-objects
Julian Lam0c37a4964562
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.jsindex 3be61c251b..b49dcab7e8 100644--- a/src/activitypub/inbox.js+++ b/src/activitypub/inbox.js@@ -430,21 +430,14 @@ inbox.announce = async (req) => {switch(true) {case object.type === 'Like': {- const id = object.object.id || object.object;- const { id: localId } = await activitypub.helpers.resolveLocalId(id);- const exists = await posts.exists(localId || id);- if (exists) {- try {- await activitypub.actors.assert(object.actor);- const result = await posts.upvote(localId || id, object.actor);- if (localId) {- socketHelpers.upvote(result, 'notifications:upvoted-your-post-in');- }- } catch (e) {- // vote denied due to local limitations (frequency, privilege, etc.); noop.- }+ const assertion = await activitypub.actors.assert(object.actor);+ if (!assertion) {+ throw new Error('[[error:activitypub.invalid-id]]');}+ req.body = object;+ await inbox.like(req);+break;}