feat(settings): add email frequency setting#2039
feat(settings): add email frequency setting#2039chrismclarke merged 6 commits intoONEARMY:masterfrom
Conversation
|
Visit the preview URL for this PR (updated for commit c6d77b3): https://onearmy-next--pr2039-2028-email-frequency-xdngqglk.web.app (expires Sat, 28 Jan 2023 15:29:26 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59 |
src/models/user.models.tsx
Outdated
| export type NotificationType = typeof NotificationTypes[number] | ||
|
|
||
| export enum EmailNotificationFrequency { | ||
| NEVER = 'never', |
There was a problem hiding this comment.
nit(blocking)
Could we change Never to an empty string? That way it can be picked up in the same way as users who have never set a preference when checking in the backend whether we need to compile a list of notifications for the user
| defaultValue={emailFrequencyOptions.find( | ||
| ({ value }) => | ||
| value === | ||
| this.props.notificationSettings?.emailFrequency ?? |
There was a problem hiding this comment.
thanks for adding the check for users without any settings (still don't have an nice way to migrate all user profiles when we add new fields).
nit(blocking)
I like the idea that this will get users without notifications enabled to automatically opt in next time they save their profile, although I think probably to keep things a bit clearer it would be better to make the default value never and we can organise a migration in the future to set another default value to all users if required.
There was a problem hiding this comment.
Looks pretty good to me! I've pushed one small PR to fix a linting issue with the functions (we don't test in our CI so not obvious) and I've added a few minor nit-picks to resolve.
Otherwise, I'd say good to go from a code-side, I'll leave you to see if you're happy with the UI @davehakkens
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
|
looks nice @evakill! |
|
thanks for the reviews! applied your comments @chrismclarke |
|
Thanks @evakill , all looks great to me One last quick thought @davehakkens - do we want this to be viewable by everyone or just beta-testers/admins to begin with? The dropdown doesn't do anything on its own at the moment and will probably be some time next month we get the email send integration in |
|
Good point @chrismclarke, might be better to start with only visable for with beta-testers and admins if we think it will take a bit more time. Than we can just merge it in now. You know how to add this auth wrapper @evakill? |
|
@davehakkens i can give it a go later this week! |
|
Just a one-liner so I've added in c6d77b3 . Nice to get this one in, will be away from tomorrow so likely will have to wait until the new year to handle the backend work for sending the emails |
|
🎉 This PR is included in version 1.34.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
PR Checklist
PR Type
Description
This PR adds a new section, Email notifications, to the user settings page. This section has a dropdown with options
never,daily,weekly,monthlythat sets theuser.notification_settings.emailFrequencyfield.Git Issues
Closes #2028
Screenshots/Videos
demo:
dropdown.demo.mov
What happens next?
Thanks for the contribution! We try to make sure all PRs are reviewed ahead of a monthly dev call (first Monday of the month, open to all!).
If the PR is working as intended it'll be merged and included in the next platform release, if not changes will be requested and re-reviewed once updated.
If you need more immediate feedback you can try reaching out on Discord in the Community Platform
developmentchannel.