From 5b19670d0ac81994f5429565e8abab79b6e99b18 Mon Sep 17 00:00:00 2001 From: AfaqShuaib09 Date: Thu, 13 Jul 2023 02:25:54 +0500 Subject: [PATCH 1/2] feat: add watchers field to course edit form --- .../EditCoursePage/EditCourseForm.jsx | 23 ++++++++++++++++ .../EditCoursePage/EditCoursePage.test.jsx | 3 +++ .../EditCourseForm.test.jsx.snap | 27 +++++++++++++++++++ .../EditCoursePage.test.jsx.snap | 13 +++++++++ src/components/EditCoursePage/index.jsx | 3 +++ 5 files changed, 69 insertions(+) diff --git a/src/components/EditCoursePage/EditCourseForm.jsx b/src/components/EditCoursePage/EditCourseForm.jsx index 4b982a10a..a4aae7273 100644 --- a/src/components/EditCoursePage/EditCourseForm.jsx +++ b/src/components/EditCoursePage/EditCourseForm.jsx @@ -1091,6 +1091,28 @@ export class BaseEditCourseForm extends React.Component { disabled={disabled} optional /> + {administrator && ( + +

+ A comma-separated list of email addresses that will be notified if the any of the course run of the course is published or scheduled. +

+ + )} + /> + } + extraInput={{ onInvalid: this.openCollapsible }} + disabled={disabled} + optional + /> + )} {administrator && ( <> @@ -1313,6 +1335,7 @@ BaseEditCourseForm.propTypes = { external_course_marketing_type: PropTypes.string, }), topics: PropTypes.arrayOf(PropTypes.string), + watchers: PropTypes.arrayOf(PropTypes.string), }), }), courseSubmitInfo: PropTypes.shape({ diff --git a/src/components/EditCoursePage/EditCoursePage.test.jsx b/src/components/EditCoursePage/EditCoursePage.test.jsx index e4e387c7f..1610a9b20 100644 --- a/src/components/EditCoursePage/EditCoursePage.test.jsx +++ b/src/components/EditCoursePage/EditCoursePage.test.jsx @@ -161,6 +161,7 @@ describe('EditCoursePage', () => { skill_names: [], organization_logo_override_url: 'http://image.src.small', organization_short_code_override: 'test short code', + watchers: [], location_restriction: { restriction_type: 'allowlist', countries: [ @@ -426,6 +427,7 @@ describe('EditCoursePage', () => { }, organization_logo_override: 'http://image.src.small', organization_short_code_override: 'test short code', + watchers: [], outcome: '

Stuff

', prerequisites_raw: '', prices: { @@ -967,6 +969,7 @@ describe('EditCoursePage', () => { }, organization_logo_override: 'http://image.src.small', organization_short_code_override: 'test short code', + watchers: [], outcome: '

Stuff

', prerequisites_raw: '', prices: { diff --git a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap index 3c545dfab..68f1356fc 100644 --- a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap +++ b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap @@ -6706,6 +6706,33 @@ exports[`BaseEditCourseForm renders html correctly with administrator being true requiredHeight={110} requiredWidth={110} /> + +

+ A comma-separated list of email addresses that will be notified if the any of the course run of the course is published or scheduled. +

+ + } + id={null} + optional={true} + text="Watchers" + /> + } + name="watchers" + optional={true} + /> ({ label: t, value: t })) : null, From 43df5ff423526c09630ff0d35ae4e2687ec836cc Mon Sep 17 00:00:00 2001 From: AfaqShuaib09 Date: Thu, 13 Jul 2023 02:42:04 +0500 Subject: [PATCH 2/2] fix: lint issues --- src/components/EditCoursePage/EditCourseForm.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/EditCoursePage/EditCourseForm.jsx b/src/components/EditCoursePage/EditCourseForm.jsx index a4aae7273..ac1fe69a5 100644 --- a/src/components/EditCoursePage/EditCourseForm.jsx +++ b/src/components/EditCoursePage/EditCourseForm.jsx @@ -1095,19 +1095,20 @@ export class BaseEditCourseForm extends React.Component {

- A comma-separated list of email addresses that will be notified if the any of the course run of the course is published or scheduled. + A comma-separated list of email addresses that will be notified if the any of the course run + of the course is published or scheduled.

)} /> - } + )} extraInput={{ onInvalid: this.openCollapsible }} disabled={disabled} optional