Explorar o código

Process stanzas from mam one-by-one

Christoph Scholz %!s(int64=5) %!d(string=hai) anos
pai
achega
cd5dacbe29
Modificáronse 2 ficheiros con 10 adicións e 1 borrados
  1. 2 0
      CHANGES.md
  2. 8 1
      src/headless/converse-mam.js

+ 2 - 0
CHANGES.md

@@ -5,6 +5,8 @@
 - Bugfix: Don't treat every duplicate message ID as a message correction; since some
   clients don't use globally unique ID's this causes false positives.
 - #1712: `TypeError: plugin._features is not a function`
+- Bugfix: process stanzas from mam one-by-one in order to correctly process message
+  receipts
 
 ## 5.0.3 (2019-09-13)
 

+ 8 - 1
src/headless/converse-mam.js

@@ -126,7 +126,14 @@ converse.plugins.add('converse-mam', {
                     }, options);
 
                 const result = await _converse.api.archive.query(query);
-                result.messages.forEach(message_handler);
+                /* eslint-disable no-await-in-loop */
+                for (const message of result.messages) {
+                    try {
+                        await message_handler(message);
+                    } catch (e) {
+                        _converse.log(e, Strophe.LogLevel.ERROR);
+                    }
+                }
 
                 if (result.error) {
                     result.error.retry = () => this.fetchArchivedMessages(options, page);