[MM-48682] Stop user from opening the servers menu when no servers are configured (#2434)

This commit is contained in:
Devin Binnie
2022-11-30 12:08:24 -04:00
committed by GitHub
parent 84ab14eabf
commit 0a32030985
2 changed files with 11 additions and 15 deletions

View File

@@ -16,7 +16,6 @@ import {
handleRemoveServerModal,
handleWelcomeScreenModal,
handleMainWindowIsShown,
handleShowOnboardingScreens,
} from './intercom';
jest.mock('common/config', () => ({
@@ -271,21 +270,16 @@ describe('main/app/intercom', () => {
Config.set.mockImplementation((name, value) => {
Config[name] = value;
});
Config.teams = JSON.parse(JSON.stringify([{
name: 'test-team',
order: 0,
url: 'https://someurl.here',
}]));
Config.registryConfigData = {
teams: JSON.parse(JSON.stringify([{
name: 'test-team',
order: 0,
url: 'https://someurl.here',
}])),
};
handleMainWindowIsShown();
expect(ModalManager.addModal).not.toHaveBeenCalled();
});
});
describe('handleShowOnboardingScreens', () => {
it('MM-48079 should not show onboarding screen or server screen if GPO server is pre-configured', () => {
handleShowOnboardingScreens(false, false, true);
expect(ModalManager.addModal).not.toHaveBeenCalled();
});
});
});

View File

@@ -254,13 +254,15 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
role: 'close',
label: isMac ? localizeMessage('main.menus.app.window.closeWindow', 'Close Window') : localizeMessage('main.menus.app.window.close', 'Close'),
accelerator: 'CmdOrCtrl+W',
}, separatorItem, {
}, separatorItem,
...(config.data?.teams.length ? [{
label: localizeMessage('main.menus.app.window.showServers', 'Show Servers'),
accelerator: `${process.platform === 'darwin' ? 'Cmd+Ctrl' : 'Ctrl+Shift'}+S`,
click() {
ipcMain.emit(OPEN_TEAMS_DROPDOWN);
},
}, ...teams.sort((teamA, teamB) => teamA.order - teamB.order).slice(0, 9).map((team, i) => {
}] : []),
...teams.sort((teamA, teamB) => teamA.order - teamB.order).slice(0, 9).map((team, i) => {
const items = [];
items.push({
label: team.name,