Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add watchers field to the Course Edit Form #890

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

AfaqShuaib09
Copy link
Contributor

@AfaqShuaib09 AfaqShuaib09 commented Jul 19, 2023

PROD-3500

This PR adds the watchers field to the course edit form. Its a list of email addresses that will receive notifications when the course run of the course is published or reviewed

@AfaqShuaib09 AfaqShuaib09 force-pushed the afaq/prod_3412 branch 2 times, most recently from aef2a67 to 4a66f31 Compare July 19, 2023 13:04
@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.09% 🎉

Comparison is base (13cbfe5) 66.86% compared to head (9214b7a) 66.95%.

❗ Current head 9214b7a differs from pull request most recent head 55cfba0. Consider uploading reports for the commit 55cfba0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #890      +/-   ##
==========================================
+ Coverage   66.86%   66.95%   +0.09%     
==========================================
  Files         128      128              
  Lines        3190     3199       +9     
  Branches      925      930       +5     
==========================================
+ Hits         2133     2142       +9     
  Misses       1008     1008              
  Partials       49       49              
Files Changed Coverage Δ
src/components/EditCoursePage/index.jsx 73.06% <ø> (+0.15%) ⬆️
src/components/EditCoursePage/EditCourseForm.jsx 80.98% <100.00%> (+0.35%) ⬆️
src/data/actions/courseInfo.js 50.78% <100.00%> (+0.38%) ⬆️
src/utils/validation.js 81.11% <100.00%> (+0.65%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AfaqShuaib09 AfaqShuaib09 changed the title feat: add watchers field feat: add watchers field to the Course Edit Form Jul 21, 2023
// emailValue should only contain alphabets, numbers, hyphen, underscore, dot and @
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/i.test(emailValue)) { return false; }
// disallow emails that have already been selected or are present in options(dropdown)
return ![...selectValue, ...options].some(x => x.label.toLowerCase() === emailValue.toLowerCase());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular validation should be on component level. This util method should only focus on email text validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Tags have a specific use-case. Email is generic, in my opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't find any benefit in moving it to the component level. Because we can reuse this function anywhere after importing it to that file

/>
)}
isMulti
disabled={!(courseInfo?.data?.course_run_statuses?.includes(REVIEW_BY_INTERNAL) && administrator)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If I remember the spec, the watchers can be added at any point (but not once scheduled/published). Double-check this.
  • We should make this field prominent, either moving to the side pane or moving higher in the course form. If the side pane does not take much effort, that would be preferrable. This particular field does not impact the course content behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the form remains in an uncleaned state due to the ordering of watcher fields coming from backend. The form field needs to be refreshed. It is already happening for many of the fields in Publisher.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I've doubled check this from specs doc
    image
  2. Ok, I'm moving this field upwards after slug field to make it prominent, adding a side pane and manage field state require some effort, can be done in some followup PR
  3. Working on it

Copy link
Contributor Author

@AfaqShuaib09 AfaqShuaib09 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the form remains in an uncleaned state due to the ordering of watcher fields coming from backend. The form field needs to be refreshed. It is already happening for many of the fields in Publisher.

Done

Copy link
Contributor

@DawoudSheraz DawoudSheraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some followup comments.

@AfaqShuaib09 AfaqShuaib09 merged commit ecfea5d into master Jul 26, 2023
5 checks passed
@AfaqShuaib09 AfaqShuaib09 deleted the afaq/prod_3412 branch July 26, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants