Commit 6078ab59 authored by witek's avatar witek

fixed message counter to be windowState aware.

parent 308b4c6b
...@@ -335,7 +335,7 @@ ...@@ -335,7 +335,7 @@
'extra_classes': message.get('delayed') && 'delayed' || '' 'extra_classes': message.get('delayed') && 'delayed' || ''
})); }));
} }
if (message.get('sender') != 'me') { if ((message.get('sender') != 'me') && (converse.windowState == 'blur')) {
converse.incrementMsgCounter(); converse.incrementMsgCounter();
} }
this.scrollDown(); this.scrollDown();
...@@ -480,7 +480,6 @@ ...@@ -480,7 +480,6 @@
if (this.model.get('status')) { if (this.model.get('status')) {
this.showStatusMessage(this.model.get('status')); this.showStatusMessage(this.model.get('status'));
} }
converse.clearMsgCounter();
}, },
template: _.template( template: _.template(
...@@ -956,7 +955,6 @@ ...@@ -956,7 +955,6 @@
this); this);
this.$el.appendTo(converse.chatboxesview.$el); this.$el.appendTo(converse.chatboxesview.$el);
this.render().show().model.messages.fetch({add: true}); this.render().show().model.messages.fetch({add: true});
converse.clearMsgCounter();
}, },
onLeave: function () { onLeave: function () {
...@@ -2121,6 +2119,14 @@ ...@@ -2121,6 +2119,14 @@
this.xmppstatus.initStatus(); this.xmppstatus.initStatus();
}, this)); }, this));
$(window).on("blur focus", $.proxy(function(e) {
if ((this.windowState != e.type) && (e.type == 'focus')) {
converse.clearMsgCounter();
}
this.windowState = e.type;
},this))
this.giveFeedback('Online Contacts'); this.giveFeedback('Online Contacts');
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment