fix: view.main (fixed no notification if on current page, added '/' before router path check)
This commit is contained in:
parent
926f5d1224
commit
c107e6c38b
11
view/main.js
11
view/main.js
|
@ -74,7 +74,7 @@ window.wsc_connect = wsc.channel('connect').listen(function(msg, err){
|
||||||
gstore.data.notif[0].data = gstore.data.notif[0].data.filter(function(item, i, arr){ return arr.indexOf(item) === i; });
|
gstore.data.notif[0].data = gstore.data.notif[0].data.filter(function(item, i, arr){ return arr.indexOf(item) === i; });
|
||||||
|
|
||||||
// -3- Update count if not already on page
|
// -3- Update count if not already on page
|
||||||
if( router.app.$route.path != 'notifications' )
|
if( router.app.$route.path != '/notifications' )
|
||||||
gstore.data.notif[0].count += gstore.data.notif[0].data.length - lastLen;
|
gstore.data.notif[0].count += gstore.data.notif[0].data.length - lastLen;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ window.wsc_connect = wsc.channel('connect').listen(function(msg, err){
|
||||||
gstore.data.notif[0].data = gstore.data.notif[0].data.filter(function(item){ return msg.disconnected.indexOf(item) === -1; });
|
gstore.data.notif[0].data = gstore.data.notif[0].data.filter(function(item){ return msg.disconnected.indexOf(item) === -1; });
|
||||||
|
|
||||||
// -2- Update count if not already on page
|
// -2- Update count if not already on page
|
||||||
if( router.app.$route.path != 'notifications' )
|
if( router.app.$route.path != '/notifications' )
|
||||||
gstore.data.notif[0].count += lastLen - gstore.data.notif[0].data.length;
|
gstore.data.notif[0].count += lastLen - gstore.data.notif[0].data.length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,14 +112,15 @@ window.wsc_chat = wsc.channel('chat').listen(function(msg, err){
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// {4} Play sound if 1msg received + not already on page //
|
// {4} Play sound if 1msg received + not already on page //
|
||||||
if( msg.msg.length == 1 && router.app.$route.path != 'inbox' )
|
// note: 1msg means a new message but not the page load past buffer
|
||||||
|
if( msg.msg.length == 1 && router.app.$route.path != '/inbox' )
|
||||||
( new Audio('/sound/notification.mp3') ).play();
|
( new Audio('/sound/notification.mp3') ).play();
|
||||||
|
|
||||||
// {5} Add messages to stack //
|
// {5} Add messages to stack //
|
||||||
gstore.data.notif[1].data = gstore.data.notif[1].data.concat( msg.msg );
|
gstore.data.notif[1].data = gstore.data.notif[1].data.concat( msg.msg );
|
||||||
|
|
||||||
// {6} Add notification count if not already on page //
|
// {6} Add notification count if not already on page //
|
||||||
if( router.app.$route.path != 'inbox' )
|
if( router.app.$route.path != '/inbox' )
|
||||||
gstore.data.notif[1].count += msg.msg.length
|
gstore.data.notif[1].count += msg.msg.length;
|
||||||
|
|
||||||
}).send({name: _SERVER.session.name});
|
}).send({name: _SERVER.session.name});
|
Loading…
Reference in New Issue