From 2ced3502509cfa2e60126baa71bbf96b53debfea Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 29 Jul 2024 16:03:58 -0400 Subject: [PATCH] fix: bug that caused remote replies to other remote content to not always assert --- src/activitypub/notes.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index a51156dd1e..3b996c90bd 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -102,7 +102,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { mainPid = utils.isNumber(mainPid) ? parseInt(mainPid, 10) : mainPid; // Relation & privilege check for local categories - const hasRelation = uid || options.skipChecks || options.cid || hasTid || await assertRelation(chain[0]); + const inputIndex = chain.map(n => n.pid).indexOf(id); + const hasRelation = + uid || hasTid || + options.skipChecks || options.cid || + await assertRelation(chain[inputIndex || 0]); const privilege = `topics:${tid ? 'reply' : 'create'}`; const allowed = await privileges.categories.can(privilege, cid, activitypub._constants.uid); if (!hasRelation || !allowed) {