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

Luis add email notification to warning tracker #2752

Merged

Conversation

luisarevalo21
Copy link
Contributor

@luisarevalo21 luisarevalo21 commented Oct 5, 2024

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.

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. Log as an Owner account.
  5. Wait for dashboard to load.
  6. Ensure the user you'll assign a warning is on a team, that has a manager on it.
  7. For testing purposes go to warningsController.js and change the emailSender 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.
Screenshot 2024-10-04 at 8 15 28 PM ![Screenshot 2024-10-04 at 8 50 44 PM](https://github.com/user-attachments/assets/e1b3ce72-d1cf-4189-beca-e76aeb325067)
  1. Next add your second email to be cc'd in the getUserRoleByEmail Function. You can add your email in the recipients array.
Screenshot 2024-10-04 at 8 17 11 PM ![Screenshot 2024-10-04 at 8 50 52 PM](https://github.com/user-attachments/assets/084c5bf6-3376-4266-b5d6-a6a6a4c9d986)
  1. Next issue the warning, selecting a user who is on a team, and issue warning in the modal.
  2. Once you receive the email, issue a blue square to the same user.
  3. You'll receive two emails one for issuing a warning and another issuing a blue square.
  4. Everything else should, work, deleting, issuing another warning etc.

Issuing Warning:

Screenshot 2024-09-28 at 8 52 29 PM

Issuing Blue square:
Screenshot 2024-09-28 at 8 54 17 PM

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.

@luisarevalo21 luisarevalo21 added the do not review Do not review or look at code without full context label Oct 5, 2024
Copy link

netlify bot commented Oct 5, 2024

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit ab30908
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/67624e67b84dda00086d7b7d
😎 Deploy Preview https://deploy-preview-2752--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@luisarevalo21 luisarevalo21 removed the do not review Do not review or look at code without full context label Oct 11, 2024
Copy link
Contributor

@Ankuriboh Ankuriboh left a 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) {
Copy link
Contributor

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();
Copy link
Contributor

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.

@anji-annavarapu
Copy link

Screenshot 2024-10-23 135616

Hey, I am trying to follow the steps in a YouTube video for OAuth authentication. I got to the 'app isn't verified' step, but in the video, there is an option to continue by clicking 'Advanced.' However, I don't see this option in my case. I have attached a screenshot for your reference. Please help if you have any ideas.

@one-community
Copy link
Member

Thank you all, merging!

@one-community one-community merged commit 4957f11 into development Dec 18, 2024
5 checks passed
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.

4 participants