[MM-38310][MM-38313][MM-38315] Fixed some issues caused by having multiple tabs (#1722)

* [MM-38313][MM-38315] Fixed some issues caused by having multiple tabs

* [MM-38310] Make sure notification navigates to correct tab
This commit is contained in:
Devin Binnie
2021-09-03 14:55:52 -04:00
committed by GitHub
parent 3213a16774
commit cfc0613d0f
12 changed files with 49 additions and 20 deletions

View File

@@ -17,7 +17,7 @@ import {
IS_UNREAD,
UNREAD_RESULT,
SESSION_EXPIRED,
SET_VIEW_NAME,
SET_VIEW_OPTIONS,
REACT_APP_INITIALIZED,
USER_ACTIVITY_UPDATE,
CLOSE_TEAMS_DROPDOWN,
@@ -31,6 +31,7 @@ let appVersion;
let appName;
let sessionExpired;
let viewName;
let shouldSendNotifications;
console.log('Preload initialized');
@@ -120,8 +121,10 @@ window.addEventListener('message', ({origin, data = {}} = {}) => {
// it will be captured by itself too
break;
case 'dispatch-notification': {
const {title, body, channel, teamId, url, silent, data: messageData} = message;
ipcRenderer.send(NOTIFY_MENTION, title, body, channel, teamId, url, silent, messageData);
if (shouldSendNotifications) {
const {title, body, channel, teamId, url, silent, data: messageData} = message;
ipcRenderer.send(NOTIFY_MENTION, title, body, channel, teamId, url, silent, messageData);
}
break;
}
case 'browser-history-push': {
@@ -179,8 +182,9 @@ ipcRenderer.on(IS_UNREAD, (event, favicon, server) => {
}
});
ipcRenderer.on(SET_VIEW_NAME, (_, name) => {
ipcRenderer.on(SET_VIEW_OPTIONS, (_, name, shouldNotify) => {
viewName = name;
shouldSendNotifications = shouldNotify;
});
function getUnreadCount() {