mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	fix: don't trust timestamps on received items
Trust the order you get from reply chain traversal and context retrieval instead.
This commit is contained in:
		| @@ -61,6 +61,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { | |||||||
| 	if (!chain || !chain.length) { | 	if (!chain || !chain.length) { | ||||||
| 		// Fall back to inReplyTo traversal on context retrieval failure | 		// 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)); | ||||||
|  | 		chain.reverse(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Can't resolve — give up. | 	// Can't resolve — give up. | ||||||
| @@ -70,7 +71,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Reorder chain items by timestamp | 	// 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]; | 	const mainPost = chain[0]; | ||||||
| 	let { pid: mainPid, tid, uid: authorId, timestamp, name, content, _activitypub } = mainPost; | 	let { pid: mainPid, tid, uid: authorId, timestamp, name, content, _activitypub } = mainPost; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user