Skip to content

Commit

Permalink
refactor: change ENABLE_TAGGING_TAXONOMY_LIST_PAGE waffle flag to DIS…
Browse files Browse the repository at this point in the history
…ABLE_TAGGING_FEATURE
  • Loading branch information
rpenido committed Apr 30, 2024
1 parent a9a73ef commit 5a4da02
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ Requirements

* ``edx-platform`` Waffle flags:

* ``new_studio_mfe.use_tagging_taxonomy_list_page``: this feature flag must be enabled.
* ``content_tagging.disable_tagging_feature``: this feature flag must NOT be checked.

Configuration
-------------

In additional to the standard settings, the following local configuration items are required:
In additional to the standard settings, the following local configuration items could be used to disable the tagging feature.

* ``ENABLE_TAGGING_TAXONOMY_PAGES``: must be enabled in order to actually present the new Tagging/Taxonomy pages.
* ``DISABLE_TAGGING_FEATURE``: can be checked in order to hide the Tagging/Taxonomy pages.


Developing
Expand Down
4 changes: 2 additions & 2 deletions src/course-outline/card-header/CardHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const CardHeader = ({
{(isVertical || isSequential) && (
<CardStatus status={status} showDiscussionsEnabledBadge={showDiscussionsEnabledBadge} />
)}
{ getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' && contentTagCount > 0 && (
{ !([true, 'true'].includes(getConfig().DISABLE_TAGGING_FEATURE)) && contentTagCount > 0 && (
<TagCount count={contentTagCount} onClick={openManageTagsDrawer} />
)}
<Dropdown data-testid={`${namePrefix}-card-header__menu`} onClick={onClickMenuButton}>
Expand Down Expand Up @@ -176,7 +176,7 @@ const CardHeader = ({
>
{intl.formatMessage(messages.menuConfigure)}
</Dropdown.Item>
{getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' && (
{!([true, 'true'].includes(getConfig().DISABLE_TAGGING_FEATURE)) && (
<Dropdown.Item
data-testid={`${namePrefix}-card-header__menu-manage-tags-button`}
onClick={openManageTagsDrawer}
Expand Down
10 changes: 5 additions & 5 deletions src/course-outline/card-header/CardHeader.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('<CardHeader />', () => {
it('only shows Manage tags menu if the waffle flag is enabled', async () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'false',
DISABLE_TAGGING_FEATURE: 'true',
});
renderComponent();
const menuButton = await screen.findByTestId('subsection-card-header__menu-button');
Expand All @@ -196,7 +196,7 @@ describe('<CardHeader />', () => {
it('shows ContentTagsDrawer when the menu is clicked', async () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
DISABLE_TAGGING_FEATURE: 'false',
});
renderComponent();
const menuButton = await screen.findByTestId('subsection-card-header__menu-button');
Expand Down Expand Up @@ -296,7 +296,7 @@ describe('<CardHeader />', () => {
it('should render tag count if is not zero and the waffle flag is enabled', async () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
DISABLE_TAGGING_FEATURE: 'false',
});
mockGetTagsCount.mockResolvedValue({ 12345: 17 });
renderComponent();
Expand All @@ -306,7 +306,7 @@ describe('<CardHeader />', () => {
it('shouldn render tag count if the waffle flag is disabled', async () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'false',
DISABLE_TAGGING_FEATURE: 'true',
});
mockGetTagsCount.mockResolvedValue({ 12345: 17 });
renderComponent();
Expand All @@ -316,7 +316,7 @@ describe('<CardHeader />', () => {
it('should not render tag count if is zero', () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
DISABLE_TAGGING_FEATURE: 'false',
});
mockGetTagsCount.mockResolvedValue({ 12345: 0 });
renderComponent();
Expand Down
2 changes: 1 addition & 1 deletion src/course-outline/status-bar/StatusBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const StatusBar = ({
</Hyperlink>
</div>
</StatusBarItem>
{getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' && (
{!([true, 'true'].includes(getConfig().DISABLE_TAGGING_FEATURE)) && (
<StatusBarItem title={intl.formatMessage(messages.courseTagsTitle)}>
<div className="d-flex align-items-center">
<TagCount count={courseTagCount} />
Expand Down
4 changes: 2 additions & 2 deletions src/course-outline/status-bar/StatusBar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('<StatusBar />', () => {
it('renders the tag count if the waffle flag is enabled', async () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
DISABLE_TAGGING_FEATURE: 'false',
});
const { findByText } = renderComponent();

Expand All @@ -157,7 +157,7 @@ describe('<StatusBar />', () => {
it('doesnt renders the tag count if the waffle flag is disabled', () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'false',
DISABLE_TAGGING_FEATURE: 'true',
});
const { queryByText } = renderComponent();

Expand Down
2 changes: 1 addition & 1 deletion src/header/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const getToolsMenuItems = ({ studioBaseUrl, courseId, intl }) => ([
href: `${studioBaseUrl}/export/${courseId}`,
title: intl.formatMessage(messages['header.links.exportCourse']),
},
...(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true'
...(!([true, 'true'].includes(getConfig().DISABLE_TAGGING_FEATURE))
? [{
href: `${studioBaseUrl}/api/content_tagging/v1/object_tags/${courseId}/export/`,
title: intl.formatMessage(messages['header.links.exportTags']),
Expand Down
4 changes: 2 additions & 2 deletions src/header/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('header utils', () => {
it('should include export tags option', () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
DISABLE_TAGGING_FEATURE: 'false',
});
const actualItemsTitle = getToolsMenuItems(props).map((item) => item.title);
expect(actualItemsTitle).toEqual([
Expand All @@ -46,7 +46,7 @@ describe('header utils', () => {
it('should not include export tags option', () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'false',
DISABLE_TAGGING_FEATURE: 'true',
});
const actualItemsTitle = getToolsMenuItems(props).map((item) => item.title);
expect(actualItemsTitle).toEqual([
Expand Down
4 changes: 2 additions & 2 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const App = () => {
{getConfig().ENABLE_ACCESSIBILITY_PAGE === 'true' && (
<Route path="/accessibility" element={<AccessibilityPage />} />
)}
{getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' && (
{!([true, 'true'].includes(getConfig().DISABLE_TAGGING_FEATURE)) && (
<>
<Route path="/taxonomies" element={<TaxonomyLayout />}>
<Route index element={<TaxonomyListPage />} />
Expand Down Expand Up @@ -121,7 +121,7 @@ initialize({
ENABLE_UNIT_PAGE: process.env.ENABLE_UNIT_PAGE || 'false',
ENABLE_ASSETS_PAGE: process.env.ENABLE_ASSETS_PAGE || 'false',
ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN: process.env.ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN || 'false',
ENABLE_TAGGING_TAXONOMY_PAGES: process.env.ENABLE_TAGGING_TAXONOMY_PAGES || 'false',
DISABLE_TAGGING_FEATURE: process.env.DISABLE_TAGGING_FEATURE || 'false',
ENABLE_HOME_PAGE_COURSE_API_V2: process.env.ENABLE_HOME_PAGE_COURSE_API_V2 === 'true',
ENABLE_CHECKLIST_QUALITY: process.env.ENABLE_CHECKLIST_QUALITY || 'true',
}, 'CourseAuthoringConfig');
Expand Down

0 comments on commit 5a4da02

Please sign in to comment.