Skip to content

Commit 48c49fe

Browse files
authored
revert: fix: Remove Studio Maintenance link (#565)
This reverts commit a229c34. We are temporarily re-introducing the Maintenance link, as the Maintenance Announcements tool is still in use, as discussed on: openedx/edx-platform#35852 For more details, see the related edx-platform revert: openedx/edx-platform#36107 In the future, this will be re-removed: openedx/edx-platform#36263
1 parent 8c77782 commit 48c49fe

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

src/Header.messages.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const messages = defineMessages({
6161
defaultMessage: 'Studio Home',
6262
description: 'Link to the Studio Home',
6363
},
64+
'header.user.menu.studio.maintenance': {
65+
id: 'header.user.menu.studio.maintenance',
66+
defaultMessage: 'Maintenance',
67+
description: 'Link to the Studio Maintenance',
68+
},
6469
'header.label.account.nav': {
6570
id: 'header.label.account.nav',
6671
defaultMessage: 'Account',

src/studio-header/StudioHeader.test.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Context as ResponsiveContext } from 'react-responsive';
1212
import { MemoryRouter } from 'react-router-dom';
1313

1414
import StudioHeader from './StudioHeader';
15+
import messages from './messages';
1516

1617
const authenticatedUser = {
1718
userId: 3,
@@ -114,6 +115,16 @@ describe('Header', () => {
114115
expect(dropdownOption).toBeVisible();
115116
});
116117

118+
it('maintenance should not be in user menu', async () => {
119+
currentUser = { ...authenticatedUser, administrator: false };
120+
const { getAllByRole, queryByText } = render(<RootWrapper {...props} />);
121+
const userMenu = getAllByRole('button')[1];
122+
await waitFor(() => fireEvent.click(userMenu));
123+
const maintenanceButton = queryByText(messages['header.user.menu.maintenance'].defaultMessage);
124+
125+
expect(maintenanceButton).toBeNull();
126+
});
127+
117128
it('user menu should use avatar icon', async () => {
118129
currentUser = { ...authenticatedUser, avatar: null };
119130
const { getByTestId } = render(<RootWrapper {...props} />);
@@ -175,6 +186,15 @@ describe('Header', () => {
175186
expect(desktopMenu).toBeNull();
176187
});
177188

189+
it('maintenance should be in user menu', async () => {
190+
const { getAllByRole, getByText } = render(<RootWrapper {...props} />);
191+
const userMenu = getAllByRole('button')[1];
192+
await waitFor(() => fireEvent.click(userMenu));
193+
const maintenanceButton = getByText(messages['header.user.menu.maintenance'].defaultMessage);
194+
195+
expect(maintenanceButton).toBeVisible();
196+
});
197+
178198
it('user menu should use avatar image', async () => {
179199
const { getByTestId } = render(<RootWrapper {...props} />);
180200
const avatarImage = getByTestId('avatar-image');

src/studio-header/messages.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ const messages = defineMessages({
66
defaultMessage: 'Studio Home',
77
description: 'Link to Studio Home',
88
},
9+
'header.user.menu.maintenance': {
10+
id: 'header.user.menu.maintenance',
11+
defaultMessage: 'Maintenance',
12+
description: 'Link to the Studio maintenance page',
13+
},
914
'header.user.menu.logout': {
1015
id: 'header.user.menu.logout',
1116
defaultMessage: 'Logout',

src/studio-header/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getConfig } from '@edx/frontend-platform';
12
import messages from './messages';
23

34
const getUserMenuItems = ({
@@ -20,6 +21,9 @@ const getUserMenuItems = ({
2021
{
2122
href: `${studioBaseUrl}`,
2223
title: intl.formatMessage(messages['header.user.menu.studio']),
24+
}, {
25+
href: `${getConfig().STUDIO_BASE_URL}/maintenance`,
26+
title: intl.formatMessage(messages['header.user.menu.maintenance']),
2327
}, {
2428
href: `${logoutUrl}`,
2529
title: intl.formatMessage(messages['header.user.menu.logout']),

0 commit comments

Comments
 (0)