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

This commit is contained in:
Julian Lam
2024-07-29 16:03:58 -04:00
parent 1f896fb6ba
commit 2ced350250

View File

@@ -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) {