Node.js based forum software built for the modern web
fix: fall back to inReplyTo traversal on context resolution failure
Julian Lam903d03891941
diff --git a/src/activitypub/contexts.js b/src/activitypub/contexts.jsindex e5debf2da6..fb53c686e3 100644--- a/src/activitypub/contexts.js+++ b/src/activitypub/contexts.js@@ -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...');Arraydiff --git a/src/activitypub/notes.js b/src/activitypub/notes.jsindex b2f3d125ea..3087216dcf 100644--- a/src/activitypub/notes.js+++ b/src/activitypub/notes.js@@ -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 failurechain = Array.from(await Notes.getParentChain(uid, input));}++ // Can't resolve — give up.if (!chain.length) {unlock(id);return null;