diff --git a/src/components/EditCoursePage/CollapsibleCourseRun.jsx b/src/components/EditCoursePage/CollapsibleCourseRun.jsx index cf1c7541c..082cee9ea 100644 --- a/src/components/EditCoursePage/CollapsibleCourseRun.jsx +++ b/src/components/EditCoursePage/CollapsibleCourseRun.jsx @@ -118,6 +118,7 @@ class CollapsibleCourseRun extends React.Component { copied: false, returnFromStaffPage: false, hasExternalKey: undefined, + isCourseRunInReview: false, }; this.openCollapsible = this.openCollapsible.bind(this); @@ -251,7 +252,7 @@ class CollapsibleCourseRun extends React.Component { courseRunTypeOptions, courseInfo, } = this.props; - const { copied, hasExternalKey } = this.state; + const { copied, hasExternalKey, isCourseRunInReview } = this.state; const { administrator } = getAuthenticatedUser(); const courseRunInReview = IN_REVIEW_STATUS.includes(courseRun.status); @@ -278,6 +279,12 @@ class CollapsibleCourseRun extends React.Component { const productSource = courseInfo?.data?.product_source?.slug; const courseType = courseInfo?.data?.course_type; + if (IN_REVIEW_STATUS.includes(courseRun.status) !== isCourseRunInReview) { + setTimeout(() => { + this.setState({ isCourseRunInReview: IN_REVIEW_STATUS.includes(courseRun.status) }); + }, 100); + } + return ( )} - {administrator && IN_REVIEW_STATUS.includes(courseRun.status) + {administrator && isCourseRunInReview && (
Status: {courseRun.status === REVIEW_BY_LEGAL ? 'Legal Review' : 'PC Review'} diff --git a/src/components/EditCoursePage/CollapsibleCourseRun.test.jsx b/src/components/EditCoursePage/CollapsibleCourseRun.test.jsx index 5eb2945fd..c6ab4efbb 100644 --- a/src/components/EditCoursePage/CollapsibleCourseRun.test.jsx +++ b/src/components/EditCoursePage/CollapsibleCourseRun.test.jsx @@ -52,6 +52,7 @@ const publishedCourseRun = { }; const unpublishedCourseRun = { ...publishedCourseRun, status: 'unpublished' }; +const inReviewCourseRun = { ...publishedCourseRun, status: 'review_by_internal' }; const currentFormValues = { course_runs: [publishedCourseRun, unpublishedCourseRun], @@ -96,6 +97,18 @@ describe('Collapsible Course Run', () => { expect(shallowToJson(component)).toMatchSnapshot(); }); + it('renders correctly when given a course run in review', () => { + const component = shallow(); + expect(shallowToJson(component)).toMatchSnapshot(); + }); + it('renders correctly with a course run type', () => { const component = shallow( `; +exports[`Collapsible Course Run renders correctly when given a course run in review 1`] = ` + + + Course run starting on Jan 01, 2000 - Self Paced + + +
+ + Publish date is Dec 31, 1999 + +
+
+ + Studio URL -  + + edX101+DemoX + + + Copy course key + + } + placement="top" + popperConfig={{}} + trigger={ + [ + "hover", + "focus", + ] + } + > + + + + + +
+
+ } +> +
+ + All fields are required for publication unless otherwise specified. + +
+
+ +

+ Required Format: yyyy/mm/dd +

+

+ The scheduled date for when the course run will be live and published. +

+

+ To publish as soon as possible, set the publish date to today. Please note that changes may take 48 hours to go live. +

+

+ If you don’t have a publish date yet, set to 1 year in the future. +

+
+ } + id="test-course.go_live_date.label" + optional={false} + text="Publish date" + /> + } + maxLength="10" + name="test-course.go_live_date" + normalize={[Function]} + pattern="20[1-9][0-9]/(0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])" + placeholder="yyyy/mm/dd" + required={false} + type="text" + /> + +

+ Course run dates are editable in Studio. +

+

+ Please note that changes in Studio may take up to a business day to be reflected here. For questions, contact your project coordinator. +

+

+ + Edit dates. + + . +

+ + } + name="test-course.start" + timeLabel="Start time (GMT)" + type="text" + /> + +

+ Course run dates are editable in Studio. +

+

+ Please note that changes in Studio may take up to a business day to be reflected here. For questions, contact your project coordinator. +

+

+ + Edit dates. + + . +

+ + } + name="test-course.end" + timeLabel="End time (GMT)" + type="text" + /> + +

+ Course run dates are editable in Studio. +

+

+ Please note that changes in Studio may take up to a business day to be reflected here. For questions, contact your project coordinator. +

+

+ + Edit dates. + + . +

+ + } + name="test-course.upgrade_deadline_override" + timeLabel="Upgrade deadline override time (UTC)" + type="date" + utcTimeZone={true} + /> + +
+ +

+ The enrollment track determines whether a course run offers a paid certificate and what sort of verification is required. +

+

+ + Learn more. + +

+ + } + id="test-course.run_type.label" + optional={false} + text="Course run enrollment track" + /> + } + name="test-course.run_type" + options={ + [ + { + "label": "Select Course enrollment track first", + "value": "", + }, + ] + } + required={true} + /> + +

+ Course pacing is editable in Studio. +

+

+ Please note that changes in Studio may take up to a business day to be reflected here. For questions, contact your project coordinator. +

+

+ + Edit course pacing. + + . +

+ + } + id="test-course.pacing_type.label" + optional={false} + text="Course pacing" + /> + } + name="test-course.pacing_type" + options={ + [ + { + "label": "Self-paced", + "value": "self_paced", + }, + ] + } + type="text" + /> + +

+ The primary instructor or instructors for the course. +

+

+ The order that instructors are listed here is the same order they will be displayed on course pages. You can drag and drop to reorder instructors. +

+ + } + id="test-course.staff.label" + optional={true} + text="Staff" + /> + +
+
+ +

+ The minimum number of hours per week the learner should expect to spend on the course. +

+
+ } + id="test-course.min_effort.label" + optional={false} + text="Minimum effort" + /> + } + name="test-course.min_effort" + required={false} + type="number" + /> +
+
+ +

+ The maximum number of hours per week the learner should expect to spend on the course. +

+
+ } + id="test-course.max_effort.label" + optional={false} + text="Maximum effort" + /> + } + name="test-course.max_effort" + required={false} + type="number" + /> + + + +

+ The estimated number of weeks the learner should expect to spend on the course, rounded to the nearest whole number. +

+ + } + id="test-course.weeks_to_complete.label" + optional={false} + text="Length" + /> + } + name="test-course.weeks_to_complete" + required={false} + type="number" + /> + + } + name="test-course.content_language" + options={ + [ + { + "label": "Arabic - United Arab Emirates", + "value": "ar-ae", + }, + ] + } + required={false} + type="text" + /> + + + +

+ If this Course Run will potentially be part of a Program, please set the expected program type here. +

+ + } + id="test-course.expected_program_type.label" + optional={true} + text="Expected Program Type" + /> + } + name="test-course.expected_program_type" + type="text" + /> + +

+ If this Course Run will potentially be part of a Program, please set the expected program name here. +

+ + } + id="test-course.expected_program_name.label" + optional={true} + text="Expected Program Name" + /> + } + name="test-course.expected_program_name" + type="text" + /> +
+ +

+ Course embargo status for OFAC is managed internally, please contact support with questions. +

+
+ } + id="ofac-notice-label" + optional={false} + text="Course Embargo (OFAC) Restriction text added to the FAQ section" + /> +
+ No +
+ + + +`; + exports[`Collapsible Course Run renders correctly when given a published course run 1`] = `