Browse Source

Process stanzas from mam one-by-one

Christoph Scholz 5 năm trước cách đây
mục cha
commit
cd5dacbe29
2 tập tin đã thay đổi với 10 bổ sung1 xóa
  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);