Skip to content

Commit

Permalink
Merge branch 'master' into bilalqamar95/workflow-update
Browse files Browse the repository at this point in the history
  • Loading branch information
BilalQamar95 authored Sep 7, 2023
2 parents fe03968 + ccd91ce commit 69203e3
Show file tree
Hide file tree
Showing 19 changed files with 3,685 additions and 6,382 deletions.
9,668 changes: 3,445 additions & 6,223 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"license": "AGPL-3.0",
"dependencies": {
"@edx/brand": "npm:@edx/[email protected]",
"@edx/frontend-component-footer": "npm:@edx/frontend-component-footer-edx@^6.0.0",
"@edx/frontend-platform": "^4.2.0",
"@edx/paragon": "^20.20.0",
"@edx/frontend-component-footer": "npm:@edx/frontend-component-footer-edx@^6.2.0",
"@edx/frontend-platform": "^4.6.0",
"@edx/paragon": "^20.44.0",
"@edx/tinymce-language-selector": "1.1.0",
"@fortawesome/free-regular-svg-icons": "6.1.1",
"@fortawesome/free-solid-svg-icons": "6.1.1",
"@fortawesome/react-fontawesome": "0.1.18",
"@tinymce/tinymce-react": "3.8.4",
"@tinymce/tinymce-react": "3.9.0",
"classnames": "2.3.2",
"connected-react-router": "6.9.3",
"core-js": "3.30.2",
Expand All @@ -43,11 +43,11 @@
"postcss": "8.4.27",
"prop-types": "15.8.1",
"query-string": "7.1.3",
"react": "16.14.0",
"react": "^17.0.2",
"react-autosuggest": "10.1.0",
"react-beautiful-dnd": "13.1.1",
"react-copy-to-clipboard": "5.1.0",
"react-dom": "16.14.0",
"react-dom": "^17.0.2",
"react-helmet": "6.1.0",
"react-redux": "7.2.9",
"react-router": "5.3.4",
Expand All @@ -66,10 +66,10 @@
"@edx/browserslist-config": "^1.2.0",
"@edx/frontend-build": "^12.7.0",
"@edx/stylelint-config-edx": "^2.3.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"axios": "0.27.2",
"axios-mock-adapter": "1.21.5",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.7",
"enzyme-to-json": "3.6.2",
"gh-pages": "3.2.3",
"husky": "7.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ exports[`CreateCoursePage renders page correctly with course create error 1`] =
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
Expand Down Expand Up @@ -327,7 +326,6 @@ exports[`CreateCoursePage renders page correctly with no publisherUserInfo 1`] =
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
Expand All @@ -337,7 +335,6 @@ exports[`CreateCoursePage renders page correctly with no publisherUserInfo 1`] =
as={
Object {
"$$typeof": Symbol(react.forward_ref),
"displayName": "DivStyledAsH4",
"render": [Function],
}
}
Expand Down Expand Up @@ -429,7 +426,6 @@ exports[`CreateCoursePage renders page correctly with org error 1`] = `
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ exports[`CreateCourseRunPage renders html correctly when error 1`] = `
"timeout": 300,
"unmountOnExit": false,
},
"displayName": "Fade",
"render": [Function],
}
}
Expand Down
1 change: 1 addition & 0 deletions src/components/EditCoursePage/CollapsibleCourseRun.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ class CollapsibleCourseRun extends React.Component {
</p>
</div>
)}
optional
/>
<Field
name={`${courseId}.staff`}
Expand Down
51 changes: 26 additions & 25 deletions src/components/EditCoursePage/EditCourseForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Collapsible from '../Collapsible';
import PriceList from '../PriceList';

import {
PUBLISHED, REVIEWED, EXECUTIVE_EDUCATION_SLUG, REVIEW_BY_INTERNAL,
PUBLISHED, REVIEWED, EXECUTIVE_EDUCATION_SLUG, UNPUBLISHED, IN_REVIEW_STATUS,
} from '../../data/constants';
import {
titleHelp, typeHelp, getUrlSlugHelp, productSourceHelp,
Expand Down Expand Up @@ -372,30 +372,31 @@ export class BaseEditCourseForm extends React.Component {
disabled={disabled || !administrator}
optional
/>
{administrator && (
<Field
name="watchers_list"
component={ReduxFormCreatableSelect}
label={(
<FieldLabel
id="watchers.label"
text="Watchers"
helpText={(
<p>
A list of email addresses that will receive
notifications when the course run of the course is published or reviewed.
</p>
)}
optional
/>
)}
isMulti
disabled={!(courseInfo?.data?.course_run_statuses?.includes(REVIEW_BY_INTERNAL) && administrator)}
optional
isCreatable
createOptionValidator={emailValidate}
/>
)}
<Field
name="watchers_list"
component={ReduxFormCreatableSelect}
label={(
<FieldLabel
id="watchers.label"
text="Watchers"
helpText={(
<p>
A list of email addresses that will receive
notifications when the course run of the course is published or reviewed.
</p>
)}
optional
/>
)}
isMulti
disabled={
!(courseInfo?.data?.course_run_statuses?.some(status => IN_REVIEW_STATUS.includes(status)
|| status === UNPUBLISHED))
}
optional
isCreatable
createOptionValidator={emailValidate}
/>
<div>
<FieldLabel helpText={productSourceHelp} id="productSource" text="Product Source" className="mb-2" />
<div className="mb-3">{parsedProductSource}</div>
Expand Down
56 changes: 56 additions & 0 deletions src/components/EditCoursePage/EditCourseForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,62 @@ describe('BaseEditCourseForm', () => {
expect(disabledFields).toHaveLength(1);
});

it('Check if watchers field is disabled after being reviewed', () => {
const courseInfoWithCourseRunStatuses = {
...courseInfo,
data: {
...courseInfo.data,
course_run_statuses: [REVIEWED],
},
};
const component = shallow(<BaseEditCourseForm
handleSubmit={() => null}
title={initialValuesFull.title}
initialValues={initialValuesFull}
currentFormValues={initialValuesFull}
number="Test101x"
entitlement={{ sku: 'ABC1234' }}
courseStatuses={[REVIEWED]}
courseInfo={courseInfoWithCourseRunStatuses}
courseOptions={courseOptions}
courseRunOptions={courseRunOptions}
uuid={initialValuesFull.uuid}
type={initialValuesFull.type}
id="edit-course-form"
/>);

const watchersField = component.find({ name: 'watchers_list', disabled: true });
expect(watchersField).toHaveLength(1);
});

it('Check if watchers field is enabled when any of the course run is in pre-reviewed status', () => {
const courseInfoWithCourseRunStatuses = {
...courseInfo,
data: {
...courseInfo.data,
course_run_statuses: [REVIEW_BY_LEGAL, UNPUBLISHED],
},
};
const component = shallow(<BaseEditCourseForm
handleSubmit={() => null}
title={initialValuesFull.title}
initialValues={initialValuesFull}
currentFormValues={initialValuesFull}
number="Test101x"
entitlement={{ sku: 'ABC1234' }}
courseStatuses={[REVIEW_BY_LEGAL, UNPUBLISHED]}
courseInfo={courseInfoWithCourseRunStatuses}
courseOptions={courseOptions}
courseRunOptions={courseRunOptions}
uuid={initialValuesFull.uuid}
type={initialValuesFull.type}
id="edit-course-form"
/>);

const watchersField = component.find({ name: 'watchers_list', disabled: false });
expect(watchersField).toHaveLength(1);
});

it('renders with course type disabled once a sku exists, even if course is unpublished', () => {
const component = shallow(<BaseEditCourseForm
handleSubmit={() => null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ exports[`Collapsible Course Run renders correctly when given a published course
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down Expand Up @@ -960,7 +960,7 @@ exports[`Collapsible Course Run renders correctly when given an unpublished cour
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down Expand Up @@ -1574,7 +1574,7 @@ exports[`Collapsible Course Run renders correctly when submitting for review 1`]
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down Expand Up @@ -2188,7 +2188,7 @@ exports[`Collapsible Course Run renders correctly when submitting for review and
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down Expand Up @@ -2814,7 +2814,7 @@ exports[`Collapsible Course Run renders correctly with a course run type 1`] = `
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down Expand Up @@ -3440,7 +3440,7 @@ exports[`Collapsible Course Run renders correctly with external key field enable
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down Expand Up @@ -4071,7 +4071,7 @@ exports[`Collapsible Course Run renders correctly with no fields 1`] = `
</div>
}
id="test-course.staff.label"
optional={false}
optional={true}
text="Staff"
/>
<Field
Expand Down
Loading

0 comments on commit 69203e3

Please sign in to comment.