From fa6d3b527939367d37df5fe00491846bb4c55c99 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Sat, 3 Apr 2021 03:11:05 -0400 Subject: [PATCH] Just-in-case sort of synced messages --- puppet/src/puppet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/puppet/src/puppet.js b/puppet/src/puppet.js index 97adc1d..3798c2e 100644 --- a/puppet/src/puppet.js +++ b/puppet/src/puppet.js @@ -584,7 +584,9 @@ export default class MessagesPuppeteer { this.log("Waiting for messages to load") const messages = await this.page.evaluate( id => window.__mautrixController.parseMessageList(id), id) - return messages.filter(msg => msg.id > minID && !this.sentMessageIDs.has(msg.id)) + return messages. + filter(msg => msg.id > minID && !this.sentMessageIDs.has(msg.id). + sort((a,b) => a.id - b.id) // TODO Confirm whether this sort is really needed } async _processChatListChangeUnsafe(id) {