scientist-softserv / palni-palci

Other
1 stars 0 forks source link

Implement Batch Email Notifications #1019

Open ShanaLMoore opened 6 months ago

ShanaLMoore commented 6 months ago

Summary

SOW

The goal is to implement batch email notifications for some activities/trigers in the Hyku application. The notifications should match those of the One-step mediated deposit workflow. That includes:

Acceptance Criteria

TASKS

Testing Instructions

  1. Be sure the tenant has a contact email set on the account settings, and one-step mediated deposit set for the admin set. (This requires approval for every work created, for example, which also triggers the notifications).
  2. Go to User profile to set the batch email notification frequency.
  3. Create a work. Notice the notification bell should have an additional alert. This alert should be what gets emailed to the user email, per the selected frequency.

Image

Image

Image

Image

Notes

Spike results: https://github.com/scientist-softserv/palni-palci/issues/1005#issuecomment-2073611653 Implementation brainstorm: https://github.com/scientist-softserv/palni-palci/issues/1005#issuecomment-2078113101

kirkkwang commented 6 months ago

https://github.com/samvera/hyrax/pull/5212 may be of interest

ShanaLMoore commented 5 months ago

QA RESULTS: Needs Rework

We will come back to check if an email got sent tomorrow. We triggered the notifications today and set the frequency to daily.

Image

re: PENDING

We can see the BatchEmailNotificationJob waiting to be run in /jobs

Image

: :

ShanaLMoore commented 5 months ago

After 24 hrs, I did not receive any emails as expected:

Image

Image

ShanaLMoore commented 5 months ago

Perhaps hyku-demo wasn't set up right. Emails are received when tested using on hyku-staging:

Image

ShanaLMoore commented 5 months ago

QA RESULTS: PASS ✅

Tested on: PALS KNAPSACK STAGING Frequency: Daily

I will check maildev in 24 hrs.

UPDATE: The email appeared:

Image

ShanaLMoore commented 4 months ago

cc @ndroark our staging mailer caught your batch email request:

Image

ctgraham commented 1 month ago

It looks like all mail for demo.palni-palci-staging.notch8.cloud is sandboxed to the "staging mailer" you describe above.

How do I get credentials for a new user in the tenant? When I create and activate a new user, I don't see a way for the user to reset their password, nor for an admin to set their password.

How do I have a user review the email notifications once created?

ShanaLMoore commented 1 month ago

@ctgraham

You would need assistance with all the above requests because of the mailer interception.

As a workaround, when you create a user an admin user can "activate" the user and it'll set the password to password.

Otherwise you can let us know what tenant/emails you are expecting and we can check it for you and screenshot the email for your review or approval.

ShanaLMoore commented 1 month ago

@ctgraham I just checked the mail server and see 2 emails. click on the links to set passwords:

Hello ctgraham+depositor@pitt.edu

Someone has invited you to https://demo.palni-palci-staging.notch8.cloud/, you can accept it through the link below.

Accept invitation

If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password.


Hello bmw118@pitt.edu

Someone has invited you to https://demo.palni-palci-staging.notch8.cloud/, you can accept it through the link below.

Accept invitation

If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password.

ctgraham commented 1 month ago

The following actions were taken in the demo.palni-palci-staging instance this week:

ShanaLMoore commented 1 month ago

I checked maildev (our staging mailbox) to see that no emails were sent because the BatchEmailNotificationJob failed. Migrations needed to be run on staging. I ran the migrations and we should hopefully see notification emails going forward.

I'm afraid you may need to redo the actions above ^^ @ctgraham for the users set to "daily" frequency as your actions were done more than a day ago, at the time of fixing staging. anything done more than a day ago won't match the query of emails to send.

To re test I created a new work and manually ran the job. the following emailed was received:

Image

https://demo.palni-palci-staging.notch8.cloud/notifications?locale=en

Image

Switched users and created a work.

email received after manually running job:

Imageat

ctgraham commented 1 month ago

ctgraham and jfudrow performed multiple editorial actions today, accepting/commenting/returning about a score of submissions.

ShanaLMoore commented 1 month ago

@ctgraham The following emails were received this morning:

Image

![Image](https://github.com/user-attachments/assets/e3280d1e-8bdf-4952-af0f-a67e4ec45f56)
![Image](https://github.com/user-attachments/assets/550b69c0-65b2-4622-b64c-204a4ad74504)
![Image](https://github.com/user-attachments/assets/c789a6c2-e1a8-4001-bf19-caf1821645e2)
![Image](https://github.com/user-attachments/assets/b66fe9b9-b295-4b5f-b667-7ee9802289fc)
ctgraham commented 1 month ago

For John Fudrow, we see two items in his Notifications Feed from two days ago, but only one item in the email. The two items are as follows. image

What caused this discrepancy?