[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:
@@ -42,6 +42,7 @@ import {
|
||||
SHOW_REMOVE_SERVER_MODAL,
|
||||
UPDATE_SHORTCUT_MENU,
|
||||
OPEN_TEAMS_DROPDOWN,
|
||||
SET_ACTIVE_VIEW,
|
||||
} from 'common/communication';
|
||||
import Config from 'common/config';
|
||||
import {MattermostServer} from 'common/servers/MattermostServer';
|
||||
@@ -241,6 +242,7 @@ function initializeInterCommunicationEventListeners() {
|
||||
ipcMain.on('update-menu', handleUpdateMenuEvent);
|
||||
ipcMain.on(UPDATE_SHORTCUT_MENU, handleUpdateShortcutMenuEvent);
|
||||
ipcMain.on(FOCUS_BROWSERVIEW, WindowManager.focusBrowserView);
|
||||
ipcMain.on(SET_ACTIVE_VIEW, handleUpdateLastActiveTab);
|
||||
|
||||
if (process.platform !== 'darwin') {
|
||||
ipcMain.on('open-app-menu', handleOpenAppMenu);
|
||||
@@ -948,3 +950,14 @@ function resizeScreen(browserWindow: BrowserWindow) {
|
||||
browserWindow.on('restore', handle);
|
||||
handle();
|
||||
}
|
||||
function handleUpdateLastActiveTab(event: IpcMainEvent, serverName: string, viewName: string) {
|
||||
const teams = config.teams;
|
||||
teams.forEach((team) => {
|
||||
if (team.name === serverName) {
|
||||
const viewIndex = team?.tabs.findIndex((tab) => tab.name === viewName);
|
||||
team.lastActiveTab = viewIndex;
|
||||
}
|
||||
});
|
||||
config.set('teams', teams);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user