Ver código fonte

Bugfix. Make sure outgoing messages all have unique ids

JC Brand 7 anos atrás
pai
commit
118a84f111
2 arquivos alterados com 3 adições e 4 exclusões
  1. 1 0
      src/converse-chatboxes.js
  2. 2 4
      src/converse-omemo.js

+ 1 - 0
src/converse-chatboxes.js

@@ -339,6 +339,7 @@
                 getOutgoingMessageAttributes (text, spoiler_hint) {
                     const is_spoiler = this.get('composing_spoiler');
                     return _.extend(this.toJSON(), {
+                        'id': _converse.connection.getUniqueId(),
                         'fullname': _converse.xmppstatus.get('fullname'),
                         'from': _converse.bare_jid,
                         'sender': 'me',

+ 2 - 4
src/converse-omemo.js

@@ -166,15 +166,13 @@
                 },
 
                 sendMessage (attrs) {
-                    const { _converse } = this.__super__;
-                    const message = this.messages.create(attrs);
-
                     if (this.get('omemo_active')) {
+                        const message = this.messages.create(attrs);
                         this.getBundlesAndBuildSessions()
                             .then((bundles) => this.createOMEMOMessageStanza(message, bundles))
                             .then((stanza) => this.sendMessageStanza(stanza));
                     } else {
-                        this.sendMessageStanza(this.createMessageStanza(message));
+                        return this.__super__.sendMessage.apply(this, arguments);
                     }
                 },
             },