Browse Source

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 10 years ago
parent
commit
c9e031e1c6
1 changed files with 3 additions and 1 deletions
  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);