[MM-47778] Remove Sign into another Server menu item when no servers exist (#2301)
This commit is contained in:
@@ -213,6 +213,27 @@ describe('main/menus/app', () => {
|
|||||||
expect(signInOption).not.toBe(undefined);
|
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', () => {
|
it('should show the first 9 servers (using order) in the Window menu', () => {
|
||||||
localizeMessage.mockImplementation((id) => {
|
localizeMessage.mockImplementation((id) => {
|
||||||
if (id === 'main.menus.app.window') {
|
if (id === 'main.menus.app.window') {
|
||||||
|
@@ -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({
|
platformAppMenu.push({
|
||||||
label: localizeMessage('main.menus.app.file.signInToAnotherServer', 'Sign in to Another Server'),
|
label: localizeMessage('main.menus.app.file.signInToAnotherServer', 'Sign in to Another Server'),
|
||||||
click() {
|
click() {
|
||||||
|
Reference in New Issue
Block a user