1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 07:56:23 +00:00

We notify user every 2 minutes but also is unread messages are different

This commit is contained in:
Loic Blot 2014-10-27 08:09:09 +00:00
parent a0babdc613
commit 4f016d89ab

View File

@ -17,6 +17,7 @@ var lastMsgDate = 0;
var unreadCountCurrentConv = 0;
var unreadCountAllConv = 0;
var unreadCountNotifStep = 12;
var lastUnreadCountAllConv = 0;
var originalTitle = document.title;
$.urlParam = function(name){
@ -125,10 +126,14 @@ var checkNewMessages = function() {
}
if (unreadCountAllConv > 0) {
// We notify user every two minutes for all messages
if (unreadCountNotifStep == 0) {
/*
* We notify user every two minutes for all messages
* or if unreadCount changes
*/
if (unreadCountNotifStep == 0 || lastUnreadCountAllConv != unreadCountAllConv) {
desktopNotify(unreadCountAllConv + " unread message(s) for all conversations");
unreadCountNotifStep = 12;
lastUnreadCountAllConv = unreadCountAllConv;
}
}
}