-
Notifications
You must be signed in to change notification settings - Fork 48
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
Luis add email notification to warning tracker #2752
Luis add email notification to warning tracker #2752
Conversation
…d send blue square to modal
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Can confirm that emails were sent, and the modal after clicking circles in the tracking dropdown on the dashboard does not crash the app.
Some trivial things can be improved, see my code comments and also the corresponding backend PR.
@@ -35,10 +40,10 @@ export const postWarningByUserId = warningData => { | |||
const response = await dispatch(postWarningsByUserId(res.data)); | |||
return response.payload.warnings; | |||
} catch (error) { | |||
if (error.response && error.response.status === 400) { | |||
return { error: 'Error occured when posting' }; | |||
if (error.response && error.response.status === 200) { |
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.
Errors should never get a 200
, this also requires backend changes.
e.preventDefault(); | ||
|
||
if (newWarning === '') return; | ||
const trimmedWarning = newWarning.trim(); |
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 would suggest adding frontend validation for special characters, even though backend already had it.
Thank you all, merging! |
Description
This PR, first addressed an issue that crashed when opening the tracking modal.
Next it added email integration, sending an email when a user receives more than 3 warnings.
Different emails are sent when receiving a warning, and 'issuing a blue square'
Note: a blue isn't assigned it only emails the user saying they received one. That'll be another PR.
Related PRS (if any):
This frontend PR is related to the #1123 backend PR .
…
Main changes explained:
Created new helper functions to send an email.
Fetched the team leads emails to cc them in the email when issuing a warning.
Adjusted the filtering method to created a flag of when to send an email
How to test:
**Before testing this branch, please follow the instructions from this PR, you must follow this exactly, and have a google auth key in order to send an email. **
OneCommunityGlobal/HGNRest#829
If you have questions/issues with this step I'd be more than happy to help.
Another note:
Ensure you have 2 emails one to receive the email and another to be cc'd.
npm install
and...
to run this PR locallywarningsController.js
and change theemailSender
to your email for both the issue warning and blue square. The first parameter will be the one who is being issued the warning. You'll add your email after a comma.getUserRoleByEmail
Function. You can add your email in the recipients array.Issuing Warning:
Issuing Blue square:
Screenshots or videos of changes:
Screen.Recording.2024-10-04.at.8.59.31.PM.mov
Screen.Recording.2024-10-04.at.9.00.10.PM.mov
Note:
Before starting, to review this PR, you must have a google auth key to send emails. Follow the PR attached, and feel free to reach out if you get stuck.