Skip to content

Node.js based forum software built for the modern web

fix: don't trust timestamps on received items

Julian Lamb1d779ca6f1e
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js
index 586bde26b5..6574465dbf 100644
--- a/src/activitypub/notes.js
+++ b/src/activitypub/notes.js
@@ -61,6 +61,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
if (!chain || !chain.length) {
// Fall back to inReplyTo traversal on context retrieval failure
chain = Array.from(await Notes.getParentChain(uid, input));
+ chain.reverse();
}
// Can't resolve — give up.
@@ -70,7 +71,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
}
// Reorder chain items by timestamp
- chain = chain.sort((a, b) => a.timestamp - b.timestamp);
+ // chain = chain.sort((a, b) => a.timestamp - b.timestamp);
const mainPost = chain[0];
let { pid: mainPid, tid, uid: authorId, timestamp, name, content, _activitypub } = mainPost;