-
Notifications
You must be signed in to change notification settings - Fork 39
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: same titles for sent email groups #205
base: master
Are you sure you want to change the base?
feat: same titles for sent email groups #205
Conversation
Thanks for the pull request, @khudym! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
e6c995f
to
a3da16d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #205 +/- ##
==========================================
+ Coverage 83.26% 83.40% +0.14%
==========================================
Files 47 50 +3
Lines 693 699 +6
Branches 135 134 -1
==========================================
+ Hits 577 583 +6
Misses 116 116 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with this code, but I took a pass over this for you. In the future, I'd recommend waiting until the master
PR has been reviewed and merged before you open the backport PRs.
@@ -219,7 +220,7 @@ function BulkEmailForm(props) { | |||
<p>{intl.formatMessage(messages.bulkEmailTaskAlertRecipients, { subject: editor.emailSubject })}</p> | |||
<ul className="list-unstyled"> | |||
{editor.emailRecipients.map((group) => ( | |||
<li key={group}>{group}</li> | |||
<li key={group}>{getDisplayTextFromRecipient(group)}</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not going to be internationalized, if I'm understanding this correctly.
You need to either:
- Make
getDisplayTextFromRecipient(group)
return a<FormattedMessage />
component, or - Make
getDisplayTextFromRecipient(group)
return aMessageDescriptor
and then pass that tointl.formatMessage(...)
as seen three lines above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree with you. Correct wrapper for localization has been added.
@@ -41,7 +42,7 @@ export default function BulkEmailRecipient(props) { | |||
<Form.Checkbox key="myself" value="myself" className="mt-2.5 col col-lg-4 col-sm-6 col-12"> | |||
<FormattedMessage | |||
id="bulk.email.form.recipients.myself" | |||
defaultMessage="Myself" | |||
defaultMessage={RECIPIENTS_DISPLAY_NAMES.myself} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but I think setting defaultMessage
to a constant like this is going to break the extraction of strings for localization. In addition, it looks confusing because it looks like it's maybe a dynamic defaultMessage. Instead, all parts of this message descriptor (the id
, the defaultMessage
, and the description
) should be put into a messages
file and then you can just reference it here as <FormattedMessage {...messages.recipientMyself} />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored according to new solution
export const RECIPIENTS_DISPLAY_NAMES = { | ||
myself: 'Myself', | ||
staff: 'Staff and instructors', | ||
learners: 'All students', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we generally prefer the term "Learner" to "Student" so this seems like a step backwards ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. It should be Learner
instead of Student
fireEvent.click(screen.getByRole('checkbox', { name: 'Myself' })); | ||
expect(screen.getByRole('checkbox', { name: 'Myself' })).toBeChecked(); | ||
fireEvent.click(screen.getByRole('checkbox', { name: RECIPIENTS_DISPLAY_NAMES.myself })); | ||
expect(screen.getByRole('checkbox', { name: RECIPIENTS_DISPLAY_NAMES.myself })).toBeChecked(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It's fine to hard-code strings in test files; it makes it easier to see when you've accidentally changed something, like accidentally setting the value of RECIPIENTS_DISPLAY_NAMES.myself
to "Learners".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, thank you for notice that. I'll revert these changes for tests.
@@ -44,8 +45,8 @@ function BulkEmailScheduledEmailsTable({ intl }) { | |||
const [currentTask, setCurrentTask] = useState({}); | |||
|
|||
useEffect(() => { | |||
setTableData(flattenScheduledEmailsArray(scheduledEmailsTable.results)); | |||
}, [scheduledEmailsTable.results]); | |||
setTableData(flattenScheduledEmailsArray(scheduledEmailsTable.results, courseModes)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the addition of courseModes
to this table. It's not mentioned in the PR description nor seems to be used anywhere ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also didn't find usage of courseModes
and remove it here.
@@ -96,7 +97,7 @@ function BulkEmailScheduledEmailsTable({ intl }) { | |||
}, | |||
} = row; | |||
const dateTime = new Date(taskDueUTC); | |||
const emailRecipients = targets.replaceAll('-', ':').split(', '); | |||
const emailRecipients = targets.replaceAll('-', ':').split(', ').map(getRecipientFromDisplayText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reversing the "display text" like this is not a very robust solution. Can you just modify flattenScheduledEmailsArray
so that it stores both the email.courseEmail.targets
IDs and the display text on row.original
? Then you won't have to do this reversing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified by adding a targetsText
values to the flattenScheduledEmailsArray
data
@khudym hi there! Just checking in to see if this is still in-progress? |
@mphilbrick211 The code has been refactored according to the comments after the review. Thank you for your friendly ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for those changes. This looks fine to me (besides one last suggestion), but I'm not familiar with this app and don't know how to test it. @mphilbrick211 Is someone else able to finish this review? I was just trying to help with some suggestions, not take on the review myself.
Co-authored-by: Braden MacDonald <mail@bradenm.com>
@openedx/committers-frontend - is someone able to finish this review? |
Description
Related Pull Requests
PR to the open-release/redwood.master branch: #207
PR to the open-release/quince.master branch: #206
Steps to reproduce
click on "Staff/Administrators" checkbox -> complete the form (subject, body) -> options:
(in this modal you can see the difference between recipients titles and selected checkbox label)
-> click "Continue" button -> wait for the "Scheduled emails" table to load and also compare titles in "Send to" column
BEFORE
Example with selected "Staff/Administrators"
Example with selected "All Learners"
AFTER