mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-21 05:54:10 +08:00
MM-67095: Hide Workspace Optimization for cloud-licensed workspaces (#36077)
Made-with: Cursor
This commit is contained in:
@@ -343,7 +343,10 @@ const AdminDefinition: AdminDefinitionType = {
|
||||
id: 'WorkspaceOptimizationDashboard',
|
||||
component: WorkspaceOptimizationDashboard,
|
||||
},
|
||||
isHidden: it.not(it.userHasReadPermissionOnResource(RESOURCE_KEYS.REPORTING.SITE_STATISTICS)),
|
||||
isHidden: it.any(
|
||||
it.not(it.userHasReadPermissionOnResource(RESOURCE_KEYS.REPORTING.SITE_STATISTICS)),
|
||||
it.licensedForFeature('Cloud'),
|
||||
),
|
||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.REPORTING.SITE_STATISTICS)),
|
||||
},
|
||||
system_analytics: {
|
||||
|
||||
@@ -12,7 +12,7 @@ import AdminSidebar from 'components/admin_console/admin_sidebar/admin_sidebar';
|
||||
import type {Props as OriginalProps} from 'components/admin_console/admin_sidebar/admin_sidebar';
|
||||
|
||||
import {samplePlugin1} from 'tests/helpers/admin_console_plugin_index_sample_pluings';
|
||||
import {renderWithContext, userEvent} from 'tests/react_testing_utils';
|
||||
import {renderWithContext, screen, userEvent} from 'tests/react_testing_utils';
|
||||
import {generateIndex} from 'utils/admin_console_index';
|
||||
|
||||
jest.mock('utils/utils', () => {
|
||||
@@ -129,6 +129,18 @@ describe('components/AdminSidebar', () => {
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should not show Workspace Optimization when Cloud license feature is enabled', () => {
|
||||
const props = {
|
||||
...defaultProps,
|
||||
license: {
|
||||
IsLicensed: 'true',
|
||||
Cloud: 'true',
|
||||
},
|
||||
};
|
||||
renderWithContext(<AdminSidebar {...props}/>);
|
||||
expect(screen.queryByText('Workspace Optimization')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should match snapshot, no access', () => {
|
||||
const props = {
|
||||
...defaultProps,
|
||||
|
||||
Reference in New Issue
Block a user