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

Shree create blue square reason scheduler forall #614

Merged

Conversation

Bhagyashree444
Copy link
Contributor

@Bhagyashree444 Bhagyashree444 commented Nov 16, 2023

Description

bug_desc_1

bug_desc_2

Related PRS (if any):

To test this backend PR you need to checkout the #1542 frontend PR.

Main changes explained:

-Updated src/controllers/reasonSchedulingController.js to remove the condition (scheduler available only to Owner and Admin role) and updated postReason and patchReason functions to generate an email to user role/you on clicking save button.

How to test:

Tips to know before watching the youtube video given below.

  1. As we are using Gmail API , make use of valid working gmail email id.
  2. Sender email id (email id used to send emails) and receiver email id (email id which receives mail from the sender email id) can be the same as sender email id or different. Keep it the same to avoid any confusion.

Also, We need to understand the 4 different places where we need to make use of the valid working email id.

  1. In .env file (use sender email id).
  2. Login on https://console.cloud.google.com/ as sender email id, so that it can verify the account that is used for sending the email.
  3. Refer Video - The Test users step is missing in the video, to add test user - after creating scopes → Test users → add users (enter sender email id). Please do not miss this step.
    Test_Users
  4. In HGN App → While updating a user role with valid working email id (can use the same sender email id or receiver email id - any valid working email id on which you want to receive the mail).

===========================================================================================

Before moving to testing, firstly you need to set up any role user with your own test email id, so that you will receive an email on this email id. This is only for test purposes.

  1. To send email using Gmail API using OAuth2 and nodemailer, kindly follow the below video and set up a test mail id.
    https://www.youtube.com/watch?v=-rcRf7yswfM&t=10s&ab_channel=MafiaCodes

  2. Fill below variable values(fill inside single quotes) in the .env file of the backend.
    REACT_APP_EMAIL =''
    REACT_APP_EMAIL_CLIENT_ID =''
    REACT_APP_EMAIL_CLIENT_SECRET =''
    REACT_APP_EMAIL_REFRESH_TOKEN =''
    REACT_APP_EMAIL_CLIENT_REDIRECT_URI='https://developers.google.com/oauthplayground'
    sendEmail = TRUE

===========================================================================================
Steps how to test

  1. check into current backend branch
  2. do npm install, npm run build and npm start to run this PR locally
  3. Login as Admin User → Update any user role with a valid/working email id using the User Management tab (so that you can receive an email on this email Id).
  4. Note down this email used above.
  5. Login as a updated user role (with valid email id) → go to dashboard → Welcome,user → view Profile → (below blue squares) Schedule Blue Square Reason → select a date and input a reason and click on save (To save the reason - either add a new reason or edit an existing one) → this would generate an email on your valid user emailId
  6. Check if you received an email on the email id used for creating the new user role.

Screenshots or videos of changes:

Pull_Request.mp4

Note:

The Refresh Token gets expired in 7 days, so if you are testing this PR after 7 days of creating the Refresh token then please create new OAuth 2.0 Client ID for the same project and update the variables (mentioned above) in .env file. (to create this follow video from 3.20 timestamp )

@ptrpengdev
Copy link
Contributor

The code base is outdated. Please do "git pull origin development" to sync with the latest code from development branch.
pr641-pullDev

@ptrpengdev
Copy link
Contributor

Hi SShree,

I attempted to test the pull request function. However, I encountered a challenge during step 5 due to the disabled "Schedule Blue Square Button." I have attached a video to this comment.

Environment Setup:

  1. Checked out the branch 'shree_create_blue_square_reason_scheduler_forall' for the backend.
  2. Checked out the branch 'shree_create_blue_square_reason_scheduler_forall_FE' for the frontend.
  3. Performed 'git pull origin development' to sync the latest code from the development branch.

Steps to reproduce the issue:

  1. Create an account for testing purposes. I will provide you with the account credentials so you could verify on your end. (Acc: [email protected], Pass: Hgn@dev2023)
  2. Log in as the newly created user (with a valid email: [email protected]), go to the dashboard, navigate to Welcome, , view Profile, and observe that the "Schedule Blue Square Button" is disabled.
  3. Log in as an admin user, and modify '[email protected]' with the Core Team role.
  4. Log in again as 'testcorepp' and repeat step 2. The button is still disabled.
video1918034154.mp4

@Bhagyashree444
Copy link
Contributor Author

The code base is outdated. Please do "git pull origin development" to sync with the latest code from development branch. pr641-pullDev

Thank you for addressing this, I have pulled all the latest changes, now it's up-to-date with development branch.

@ptrpengdev ptrpengdev self-requested a review November 16, 2023 17:52
Copy link
Contributor

@ptrpengdev ptrpengdev left a comment

Choose a reason for hiding this comment

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

Looks good to me.
Functionality tested:

  • Gmail API is functional
pr614_mail_sucess

Copy link

@keyunhuangg keyunhuangg left a comment

Choose a reason for hiding this comment

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

I used my email as both the sender and receiver here. Successfully sent a total of 5 emails with different dates.
Each email was appropriately triggered by the system in response to the 'Save' action after scheduling a blue square reason.
Verified the receipt of all 5 emails in the test email account. The content and dates in the received emails were as expected, confirming that the email functionality is operating correctly.

Below I have attached the screenshot of these events:
Screenshot 2023-11-16 at 6 29 19 PM
Screenshot 2023-11-16 at 6 23 10 PM

Copy link
Contributor

@Shuhua-L Shuhua-L left a comment

Choose a reason for hiding this comment

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

Hey @Bhagyashree444,

I received email notifications as expected when I successfully set/update a Blue Square Reason. Nice work👏!

My only concern, though, is the changes in .gitattributes, which are related to the CRLF vs LF battle and have sparked several conversations in Slack. I'm not sure if this is the solution to the linting challenge, but I would recommend that you only commit the changes related to the Blue Square Scheduler. If you want to update git configurations, you can make another PR for that. Once you've addressed these, we're good to merge.

PR1542+614.mov

Copy link

@KavyaAlla KavyaAlla left a comment

Choose a reason for hiding this comment

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

Hi @Bhagyashree444 , Everything is working as expected. Details at OneCommunityGlobal/HighestGoodNetworkApp#1542 (review)

Copy link
Contributor

@Shuhua-L Shuhua-L left a comment

Choose a reason for hiding this comment

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

Looking solid! Appreciate your effort! 🙌

@Bhagyashree444 Bhagyashree444 removed the request for review from shiva2096 November 17, 2023 17:57
Copy link
Contributor

@Haoj1 Haoj1 left a comment

Choose a reason for hiding this comment

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

@Bhagyashree444 Looks good to me! Comments are left in frontend PR OneCommunityGlobal/HighestGoodNetworkApp#1542 (review)

Copy link

@Changhao3220K Changhao3220K left a comment

Choose a reason for hiding this comment

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

backend works perfectly, tested the gmail API and received the email notification.
Screenshot 2023-11-16 at 8 41 18 PM
Screenshot 2023-11-16 at 8 45 00 PM

good job @Bhagyashree444

Copy link

@Hemsharavanan Hemsharavanan left a comment

Choose a reason for hiding this comment

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

  • Received email immediately after assigning the blue square.
  • Functionality and the validation works fine.
  • Below is the video testing functionality of node mailer implementation and integration Gmail API
PR.614.Backend.mp4

@one-community
Copy link
Member

Thank you all, moving to final review.

Copy link

@pika-chu11 pika-chu11 left a comment

Choose a reason for hiding this comment

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

Comment left at frontEnd #1542 great job!

@one-community one-community merged commit 377df05 into development Nov 19, 2023
3 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.

10 participants