Skip to content

Commit

Permalink
feat: removal of feature flags and release of exec ed inclusion (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sheehan-edx authored Jan 11, 2023
1 parent bbf795c commit ae56a33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
19 changes: 9 additions & 10 deletions src/components/catalogPage/CatalogPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Subheader from '../subheader/subheader';
import Hero from '../hero/Hero';
import messages from './CatalogPage.messages';
import CatalogSelectionDeck from '../catalogSelectionDeck/CatalogSelectionDeck';
import features from '../../config';
import {
AVAILABILITY_REFINEMENT,
AVAILABILITY_REFINEMENT_DEFAULTS,
Expand Down Expand Up @@ -55,20 +54,20 @@ function CatalogPage({ intl }) {
reloadPage = true;
}

// Remove the `learning_type = executive education` filter if the feature flag is disabled or if the selected
// Remove the `learning_type = executive education` filter if the selected
// catalog isn't `a la carte`
if (
(!features.EXEC_ED_INCLUSION
|| (config.EDX_ENTERPRISE_ALACARTE_TITLE
&& loadedSearchParams.get(LEARNING_TYPE_REFINEMENT)
&& !(
loadedSearchParams.get(QUERY_TITLE_REFINEMENT)
=== config.EDX_ENTERPRISE_ALACARTE_TITLE
)))
(config.EDX_ENTERPRISE_ALACARTE_TITLE
&& !(
loadedSearchParams.get(QUERY_TITLE_REFINEMENT)
=== config.EDX_ENTERPRISE_ALACARTE_TITLE
))
&& loadedSearchParams.get(LEARNING_TYPE_REFINEMENT)
=== EXECUTIVE_EDUCATION_2U_COURSE_TYPE
) {
const loadedLearningTypes = loadedSearchParams.getAll(LEARNING_TYPE_REFINEMENT);
const loadedLearningTypes = loadedSearchParams.getAll(
LEARNING_TYPE_REFINEMENT,
);
if (loadedLearningTypes.length) {
loadedSearchParams.delete(LEARNING_TYPE_REFINEMENT);
loadedLearningTypes.forEach((type) => {
Expand Down
18 changes: 0 additions & 18 deletions src/components/catalogPage/CatalogPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,7 @@ describe('CatalogPage', () => {
'enterprise_catalog_query_titles=baz&availability=Available+Now&availability=Starting+Soon&availability=Upcoming',
);
});
it('accounts for exec ed inclusion feature flag', () => {
process.env.EXEC_ED_INCLUSION = false;
const location = {
...window.location,
search: '?learning_type=executive-education-2u',
};
Object.defineProperty(window, 'location', {
writable: true,
value: location,
});
expect(window.location.search).toEqual('?learning_type=executive-education-2u');
renderWithRouter(<CatalogPage />);
// Assert we've removed the exec ed learning type because the feature flag was disabled
expect(window.location.search).toEqual(
'enterprise_catalog_query_titles=baz&availability=Available+Now&availability=Starting+Soon&availability=Upcoming',
);
});
it('accounts for exec ed disclusion when not a la carte is selected', () => {
process.env.EXEC_ED_INCLUSION = true;
const location = {
...window.location,
search: '?learning_type=executive-education-2u&learning_type=ayylmao&enterprise_catalog_query_titles=foobar',
Expand Down
8 changes: 1 addition & 7 deletions src/components/catalogs/CatalogSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
NUM_RESULTS_PROGRAM,
NUM_RESULTS_PER_PAGE,
} from '../../constants';
import features from '../../config';
import CatalogSearchResults from '../catalogSearchResults/CatalogSearchResults';
import CatalogInfoModal from '../catalogInfoModal/CatalogInfoModal';
import {
Expand Down Expand Up @@ -159,7 +158,6 @@ function CatalogSearch(intl) {
&& !enterpriseCatalogQueryTitles.includes(
config.EDX_ENTERPRISE_ALACARTE_TITLE,
))
|| !features.EXEC_ED_INCLUSION
) {
if (contentToDisplay.indexOf(EXECUTIVE_EDUCATION_2U_COURSE_TYPE) > 0) {
contentToDisplay.splice(
Expand Down Expand Up @@ -217,11 +215,7 @@ function CatalogSearch(intl) {
return itemsWithResultsList;
};

const defaultInstantSearchFilter = `learning_type:${CONTENT_TYPE_COURSE} OR learning_type:${CONTENT_TYPE_PROGRAM}${
features.EXEC_ED_INCLUSION
? ` OR learning_type:${EXECUTIVE_EDUCATION_2U_COURSE_TYPE}`
: ''
}`;
const defaultInstantSearchFilter = `learning_type:${CONTENT_TYPE_COURSE} OR learning_type:${CONTENT_TYPE_PROGRAM} OR learning_type:${EXECUTIVE_EDUCATION_2U_COURSE_TYPE}`;

return (
<PageWrapper className="mt-3 mb-5 page-width">
Expand Down

0 comments on commit ae56a33

Please sign in to comment.