Display the number of notifications on page title.

This commit is contained in:
Pierre HUBERT
2018-11-24 16:01:45 +01:00
parent d49b04e6fb
commit 46bb22b17b
15 changed files with 89 additions and 11 deletions

View File

@ -22,8 +22,11 @@ ComunicWeb.components.notifications.service = {
var interval = setInterval(function(){
//Auto-remove interval if the target has been removed
if(!target.isConnected)
if(!target.isConnected){
ComunicWeb.common.pageTitle.setNotificationsNumber(0);
return clearInterval(interval);
}
//Get the number of notifications from the API
ComunicWeb.components.notifications.interface.getAllUnread(function(response){
@ -55,6 +58,8 @@ ComunicWeb.components.notifications.service = {
}
//Update page title too
ComunicWeb.common.pageTitle.setNotificationsNumber(response.notifications + response.conversations);
});
}, 2000);