Skip to content

feat(settings): add email frequency setting#2039

Merged
chrismclarke merged 6 commits intoONEARMY:masterfrom
evakill:2028-email-frequency-setting
Dec 21, 2022
Merged

feat(settings): add email frequency setting#2039
chrismclarke merged 6 commits intoONEARMY:masterfrom
evakill:2028-email-frequency-setting

Conversation

@evakill
Copy link
Contributor

@evakill evakill commented Dec 16, 2022

PR Checklist

PR Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Developer experience (improves developer workflows for contributing to the project)

Description

This PR adds a new section, Email notifications, to the user settings page. This section has a dropdown with options never, daily, weekly, monthly that sets the user.notification_settings.emailFrequency field.

Git Issues

Closes #2028

Screenshots/Videos

demo:

  • dropdown selection with four selectable options
  • setting persists on save
  • dropdown defaults to saved setting on load
  • setting does not persist if not saved
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 development channel.

@evakill evakill requested a review from a team as a code owner December 16, 2022 19:10
@davehakkens davehakkens added the Review allow-preview ✅ Has received manual check for malicious code and can be safely built for preview label Dec 16, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2022

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

export type NotificationType = typeof NotificationTypes[number]

export enum EmailNotificationFrequency {
NEVER = 'never',
Copy link
Member

Choose a reason for hiding this comment

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

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 ??
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Member

@chrismclarke chrismclarke left a comment

Choose a reason for hiding this comment

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

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

@cypress
Copy link

cypress bot commented Dec 16, 2022



Test summary

52 0 0 0Flakiness 0


Run details

Project onearmy-community-platform
Status Passed
Commit c6d77b3
Started Dec 21, 2022 4:39 AM
Ended Dec 21, 2022 4:41 AM
Duration 02:43 💡
OS Linux Ubuntu - 20.04
Browser Chrome 108

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

@davehakkens
Copy link
Contributor

looks nice @evakill!

@evakill
Copy link
Contributor Author

evakill commented Dec 17, 2022

thanks for the reviews! applied your comments @chrismclarke

@chrismclarke
Copy link
Member

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

@davehakkens
Copy link
Contributor

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?

@evakill
Copy link
Contributor Author

evakill commented Dec 20, 2022

@davehakkens i can give it a go later this week!

@chrismclarke
Copy link
Member

Just a one-liner so I've added in c6d77b3 .
I don't think there's actually a way to limit anything to multiple roles (e.g. both beta-testers and admins), so have just set to beta-testers for now and any admins that want to test can assign themselves the role (users can have multiple).

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

@chrismclarke chrismclarke merged commit c69f9cc into ONEARMY:master Dec 21, 2022
@onearmy-bot
Copy link
Collaborator

🎉 This PR is included in version 1.34.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review allow-preview ✅ Has received manual check for malicious code and can be safely built for preview

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add mail notifications setting to user profile (frontend)

4 participants