瀏覽代碼

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 年之前
父節點
當前提交
c9e031e1c6
共有 1 個文件被更改,包括 3 次插入1 次删除
  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);