Skip to content

Node.js based forum software built for the modern web

fix: bug that caused remote replies to other remote content to not always assert

Julian Lam2ced3502509c
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) {