fix: add in a deduplication guard after calling contexts.getItems

This commit is contained in:
Julian Lam
2026-04-02 15:31:45 -04:00
parent 5a04916879
commit b3600e0b7f

View File

@@ -84,6 +84,14 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
} else if (context.context) {
chain = Array.from(await activitypub.contexts.getItems(uid, context.context, { input }));
if (chain && chain.length) {
// Deduplicate by id (just in case, also a buggy NodeBB impl. sent dupes)
const ids = new Set();
chain = chain.filter((item) => {
const seen = ids.has(item.pid);
ids.add(item.pid);
return !seen;
});
// Context resolves, use in later topic creation
context = context.context;
}