[MM-47778] Remove Sign into another Server menu item when no servers exist (#2301)

This commit is contained in:
Devin Binnie
2022-10-21 09:14:02 -04:00
committed by GitHub
parent 167f7d832a
commit 179eacb582
2 changed files with 22 additions and 1 deletions

View File

@@ -213,6 +213,27 @@ describe('main/menus/app', () => {
expect(signInOption).not.toBe(undefined);
});
it('should not show `Sign in to Another Server` if no teams are configured', () => {
localizeMessage.mockImplementation((id) => {
switch (id) {
case 'main.menus.app.file':
return '&File';
case 'main.menus.app.file.signInToAnotherServer':
return 'Sign in to Another Server';
default:
return '';
}
});
const modifiedConfig = {
...config,
teams: [],
};
const menu = createTemplate(modifiedConfig);
const fileMenu = menu.find((item) => item.label === '&AppName' || item.label === '&File');
const signInOption = fileMenu.submenu.find((item) => item.label === 'Sign in to Another Server');
expect(signInOption).not.toBe(undefined);
});
it('should show the first 9 servers (using order) in the Window menu', () => {
localizeMessage.mockImplementation((id) => {
if (id === 'main.menus.app.window') {

View File

@@ -45,7 +45,7 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
},
});
if (config.data?.enableServerManagement === true) {
if (config.data?.enableServerManagement === true && config.data?.teams.length > 0) {
platformAppMenu.push({
label: localizeMessage('main.menus.app.file.signInToAnotherServer', 'Sign in to Another Server'),
click() {