Skip to content

Commit dcab4f1

Browse files
feat: add NON_BROWSABLE_COURSES to MFE config (#620)
1 parent 66fdd79 commit dcab4f1

File tree

6 files changed

+12
-2
lines changed

6 files changed

+12
-2
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ ENABLE_NOTICES=''
4141
CAREER_LINK_URL=''
4242
ENABLE_EDX_PERSONAL_DASHBOARD=false
4343
ENABLE_PROGRAMS=false
44+
NON_BROWSABLE_COURSES=false

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ ENABLE_NOTICES=''
4747
CAREER_LINK_URL=''
4848
ENABLE_EDX_PERSONAL_DASHBOARD=false
4949
ENABLE_PROGRAMS=false
50+
NON_BROWSABLE_COURSES=false

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ ENABLE_NOTICES=''
4646
CAREER_LINK_URL=''
4747
ENABLE_EDX_PERSONAL_DASHBOARD=true
4848
ENABLE_PROGRAMS=false
49+
NON_BROWSABLE_COURSES=false

src/config/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const configuration = {
1919
ENABLE_EDX_PERSONAL_DASHBOARD: process.env.ENABLE_EDX_PERSONAL_DASHBOARD === 'true',
2020
SEARCH_CATALOG_URL: process.env.SEARCH_CATALOG_URL || null,
2121
ENABLE_PROGRAMS: process.env.ENABLE_PROGRAMS === 'true',
22+
NON_BROWSABLE_COURSES: process.env.NON_BROWSABLE_COURSES === 'true',
2223
};
2324

2425
const features = {};

src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ const getLearnerHeaderMenu = (
2222
href: `${urls.programsUrl()}`,
2323
content: formatMessage(messages.program),
2424
}] : []),
25-
{
25+
...(!getConfig().NON_BROWSABLE_COURSES ? [{
2626
type: 'item',
2727
href: `${urls.baseAppUrl(courseSearchUrl)}`,
2828
content: formatMessage(messages.discoverNew),
2929
onClick: (e) => {
3030
exploreCoursesClick(e);
3131
},
32-
},
32+
}]
33+
: []),
3334
],
3435
secondaryMenu: [
3536
...(getConfig().SUPPORT_URL ? [{

src/containers/LearnerDashboardHeader/index.test.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ describe('LearnerDashboardHeader', () => {
4444
const wrapper = shallow(<LearnerDashboardHeader />);
4545
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(3);
4646
});
47+
test('should not display Discover New tab if it is disabled by configuration', () => {
48+
mergeConfig({ NON_BROWSABLE_COURSES: true });
49+
const wrapper = shallow(<LearnerDashboardHeader />);
50+
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(2);
51+
});
4752
});

0 commit comments

Comments
 (0)