Explorar o código

Fix num_unread*2 on minimized chat

When chat was minimized the counter num_unread of unread message was increment when receiving a compose message so the number of unread messages was doubled.
Deuteu %!s(int64=10) %!d(string=hai) anos
pai
achega
c9e031e1c6
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      converse.js

+ 3 - 1
converse.js

@@ -3034,7 +3034,9 @@
             },
 
             initialize: function () {
-                this.model.messages.on('add', this.updateUnreadMessagesCounter, this);
+                this.model.messages.on('add', function(msg) {
+                        if (!msg.attributes.composing) {this.updateUnreadMessagesCounter();}
+                    } , this);
                 this.model.on('showSentOTRMessage', this.updateUnreadMessagesCounter, this);
                 this.model.on('showReceivedOTRMessage', this.updateUnreadMessagesCounter, this);
                 this.model.on('change:minimized', this.clearUnreadMessagesCounter, this);