mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
fix: incorrect parsing of context items during note assertion, logic error with slicing
This commit is contained in:
@@ -48,7 +48,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
const { tid } = context;
|
const { tid } = context;
|
||||||
return { tid, count: 0 };
|
return { tid, count: 0 };
|
||||||
} else if (context.context) {
|
} else if (context.context) {
|
||||||
chain = Array.from(await activitypub.contexts.getItems(uid, context));
|
chain = Array.from(await activitypub.contexts.getItems(uid, context.context));
|
||||||
} else {
|
} else {
|
||||||
// Fall back to inReplyTo traversal
|
// Fall back to inReplyTo traversal
|
||||||
chain = Array.from(await Notes.getParentChain(uid, input));
|
chain = Array.from(await Notes.getParentChain(uid, input));
|
||||||
@@ -71,7 +71,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
await topics.tools.move(tid, { cid: options.cid, uid: 'system' });
|
await topics.tools.move(tid, { cid: options.cid, uid: 'system' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.slice(0, -1).map(p => p.pid));
|
const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.slice(1).map(p => p.pid));
|
||||||
members.unshift(await posts.exists(mainPid));
|
members.unshift(await posts.exists(mainPid));
|
||||||
if (tid && members.every(Boolean)) {
|
if (tid && members.every(Boolean)) {
|
||||||
// All cached, return early.
|
// All cached, return early.
|
||||||
|
|||||||
Reference in New Issue
Block a user