mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-31 04:57:59 +02: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;
|
next = first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Early breakout on empty collection
|
||||||
|
if (!chain.size) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
winston.verbose('[activitypub/context] Fetching next page...');
|
winston.verbose('[activitypub/context] Fetching next page...');
|
||||||
Array
|
Array
|
||||||
|
|||||||
@@ -49,10 +49,14 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
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.context, { input }));
|
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));
|
chain = Array.from(await Notes.getParentChain(uid, input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can't resolve — give up.
|
||||||
if (!chain.length) {
|
if (!chain.length) {
|
||||||
unlock(id);
|
unlock(id);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user