Conversation
e931bcb to
f5c047b
Compare
|
@andreslucena. Where should be the documentation relative to this feature? in a page in this repo, or in docs repo? |
It depends in which kind of docs did you have in mind. If it's for developers/implementers, then it should be here ( |
|
Uops sorry for closing this, wrong click 😅 |
|
@quinHD Can you normalize the locales? |
ferblape
left a comment
There was a problem hiding this comment.
Just a few details to review, plus I miss a test about the use of the digest_sent_at attribute, for example checking that this field value blocks emails already been sent.
decidim-core/db/migrate/20220203121137_add_notifications_sending_frequency_to_users.rb
Show resolved
Hide resolved
decidim-core/app/mailers/decidim/notifications_digest_mailer.rb
Outdated
Show resolved
Hide resolved
decidim-core/app/jobs/decidim/email_notifications_digest_generator_job.rb
Show resolved
Hide resolved
decidim-core/app/jobs/decidim/email_notifications_digest_generator_job.rb
Outdated
Show resolved
Hide resolved
decidim-core/app/jobs/decidim/email_notifications_digest_generator_job.rb
Outdated
Show resolved
Hide resolved
|
Also, take care with the I18n, it needs to be normalized |
|
ready to review @decidim/product |
decidim-core/app/presenters/decidim/notifications_digest_presenter.rb
Outdated
Show resolved
Hide resolved
|
I have reviewed it locally, and there are some things that we need to change regarding the flow and feature. Please merge with develop and also configure it in decidim.populate.tools/letter_opener so we can check the UI with @carolromero I found confusing having to check the "Send notifications by email" and also the "How often do you want to receive the notifications digest email?" at the same time to receive notifications. The whole point of this feature is that I already receive too many emails from notifications. I think this could be easily fixed by:
Regarding where to add the docs for implementers, I think it's easier to discover on the section for scheduled tasks in the install guide (docs/modules/install/pages/index.adoc) and also a few lines in the CHANGELOG so it's easier to find by existing implementers. So the ACs have changed reflecting better this so it's easier to keep track of it. |
andreslucena
left a comment
There was a problem hiding this comment.
There are some merge conflicts, and I have a couple suggestions. Can you give it a look please? Thanks!
decidim-core/db/migrate/20220203121137_add_notifications_sending_frequency_to_users.rb
Show resolved
Hide resolved
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
|
@andreslucena feedback added and conflicts fixed |
ahukkanen
left a comment
There was a problem hiding this comment.
I really like how elegantly this is implemented, great work! It was a pleasure to read through.
I just noticed one unnecessary addition as far as I understood, so could you take a look at that?
Also, can you solve the merge conflicts and fix the Rubocop issue after merging with develop please? 🙏
Also, I noticed a potential bug but I'll post it as a separate message below.
decidim-core/spec/commands/decidim/update_notifications_settings_spec.rb
Outdated
Show resolved
Hide resolved
|
I'm not sure if I have something misconfigured but when I tried the "real time" notifications locally, it was generating duplicate records for me as shown in the video below: decidim-dupicate-notification.mp4Because of this, it was also sending duplicate emails to me. I tried this locally and I was running the jobs through the I tried the same also on Could you take a look at this? |
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
|
Thanks for your time and your review @ahukkanen I haven't been able to reproduce the double notification issue. I've tried both without async_adapter, and with a job adapter configured, and in both cases only one notification was generated Also, I reviewed the logs and everything look ok: just a single job enqueued, job which internally generates a couple more of jobs, one for the notification and the other for the email. Could you pase your development log when you have time to debug what could fail? |
Thanks @ferblape ! It must have been some misconfiguration on my end because today I just regenerated the development_app from scratch and now only one job is enqueued and I cannot replicate the bug. So functionality-wise it all good now! I'll take another look at the changes and it should be good to go on my part. |
* Add notifications digest email * Fix specs & lints * Fix erb lint * Remove unused frequency radio button * Refactor radio buttons in notifications settings * Fix i18n spec * Add notifications frequency to form * Add notifications digest documentation * Add none to notification frequency * Remove relations in mailer arguments * Refactor mail notifications digest sending method * Fix error in migration * Fix lint * Add spec for notifications digest sending decider * Rearrange notification settings * Remove email_on_notification attribute * Fix locales order * Fix lint * Fix i18n specs * Fix meetings specs * Update docs with mailer * Add to changelog * Refactor migration * Clarification on the documentation * Convert to local variable * Remove comment * Add field to serializer * Test on form * Simplify migrations * Fix default value for new users * Add more details to changelog * Typo * Fix spec * Update CHANGELOG.md Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update docs/modules/install/pages/index.adoc Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Ruby linter * Remove docs from installation page * Use symbols Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Fix offenses * Fix i18n * Fix offenses Co-authored-by: Fernando Blat <fernando@blat.es> Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
* Add notifications digest email * Fix specs & lints * Fix erb lint * Remove unused frequency radio button * Refactor radio buttons in notifications settings * Fix i18n spec * Add notifications frequency to form * Add notifications digest documentation * Add none to notification frequency * Remove relations in mailer arguments * Refactor mail notifications digest sending method * Fix error in migration * Fix lint * Add spec for notifications digest sending decider * Rearrange notification settings * Remove email_on_notification attribute * Fix locales order * Fix lint * Fix i18n specs * Fix meetings specs * Update docs with mailer * Add to changelog * Refactor migration * Clarification on the documentation * Convert to local variable * Remove comment * Add field to serializer * Test on form * Simplify migrations * Fix default value for new users * Add more details to changelog * Typo * Fix spec * Update CHANGELOG.md Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update docs/modules/install/pages/index.adoc Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Ruby linter * Remove docs from installation page * Use symbols Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Fix offenses * Fix i18n * Fix offenses Co-authored-by: Fernando Blat <fernando@blat.es> Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
* Add notifications digest email * Fix specs & lints * Fix erb lint * Remove unused frequency radio button * Refactor radio buttons in notifications settings * Fix i18n spec * Add notifications frequency to form * Add notifications digest documentation * Add none to notification frequency * Remove relations in mailer arguments * Refactor mail notifications digest sending method * Fix error in migration * Fix lint * Add spec for notifications digest sending decider * Rearrange notification settings * Remove email_on_notification attribute * Fix locales order * Fix lint * Fix i18n specs * Fix meetings specs * Update docs with mailer * Add to changelog * Refactor migration * Clarification on the documentation * Convert to local variable * Remove comment * Add field to serializer * Test on form * Simplify migrations * Fix default value for new users * Add more details to changelog * Typo * Fix spec * Update CHANGELOG.md Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update docs/modules/install/pages/index.adoc Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Ruby linter * Remove docs from installation page * Use symbols Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi> * Fix offenses * Fix i18n * Fix offenses Co-authored-by: Fernando Blat <fernando@blat.es> Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

🎩 What? Why?
This PR adds the mail digest feature for user notifications. It makes available a rake task to send the email only to the selected users. It can be invoked from a cron job.
📌 Related Issues
#8486
Testing
Describe the best way to test or validate your PR.
#####Acceptance criteria#####
When I go to https://docs.decidim.org/en/install/#_scheduled_tasks I have instructions on how to set this feature for new apps. (docs/modules/install/pages/index.adoc)
When I go to the CHANGELOG I have instructions on how to set this feature for existing apps.
When I go to "My account" -> "Notifications settings"
Then I see a new section "How often do you want to receive the notifications emails?" with the options "None", "Real time", "Daily" and "Weekly"
When I go to "My account" -> "Notifications settings"
Then I have selected the "Real time" option in "How often do you want to receive the notifications emails?"
When I go to "My account" -> "Notifications settings"
Then I have selected the "Daily" option by default in "How often do you want to receive the notifications emails?"
When I have selected the "None" option in "How often do you want to receive the notifications emails?"
Then I don't receive any notifications emails.
When I have selected the "Real time" option in "How often do you want to receive the notifications emails?"
Then I receive emails every time I have a notification.
When I have selected the "Daily" option in "How often do you want to receive the notifications emails?"
Then I receive one email with my notifications from yesterday.
When I have selected the "Weekly" option in "How often do you want to receive the notifications emails?"
Then I receive one email with my notifications from the last week.
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.📷 Screenshots
Please add screenshots of the changes you're proposing
