mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: fall back to inReplyTo traversal on context resolution failure
This commit is contained in:
@@ -79,6 +79,11 @@ Contexts.getItems = async (uid, id, options) => {
|
||||
next = first;
|
||||
}
|
||||
|
||||
// Early breakout on empty collection
|
||||
if (!chain.size) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (next) {
|
||||
winston.verbose('[activitypub/context] Fetching next page...');
|
||||
Array
|
||||
|
||||
@@ -49,10 +49,14 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
return { tid, count: 0 };
|
||||
} else if (context.context) {
|
||||
chain = Array.from(await activitypub.contexts.getItems(uid, context.context, { input }));
|
||||
} else {
|
||||
// Fall back to inReplyTo traversal
|
||||
}
|
||||
|
||||
if (!chain) {
|
||||
// Fall back to inReplyTo traversal on context retrieval failure
|
||||
chain = Array.from(await Notes.getParentChain(uid, input));
|
||||
}
|
||||
|
||||
// Can't resolve — give up.
|
||||
if (!chain.length) {
|
||||
unlock(id);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user