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

Add a preferred email option in account settings (Fixes #408) #440

Merged
merged 3 commits into from
May 31, 2024

Conversation

MelissaAutumn
Copy link
Member

@MelissaAutumn MelissaAutumn commented May 30, 2024

Fixes #408

This PR adds a dropdown to select the users preferred email with a tooltip explaining what that option does:

image image

We don't have an email verification system, so I'm only pulling from FXA + Google Connections. So if you connect with your personal google account you can use that email for booking emails, and events.

To facilitate this functionality I've added a secondary_email address to the subscribers table, and a preferred_email property to the subscribers model. The preferred_email property returns either the secondary_email or if that's null, the email. For any outgoing email usage you should always use preferred_email. email should only be used in context of login/auth, and secondary_email should only be used during updates relating to the dropdown.

I believe I've caught all of the outgoing email usage, but feel free to let me know if I've missed anything.

@MelissaAutumn MelissaAutumn added the l10n update A string has been added or needs updating label May 30, 2024
@MelissaAutumn MelissaAutumn requested a review from devmount May 30, 2024 16:56
@MelissaAutumn MelissaAutumn self-assigned this May 30, 2024
"""Return the list of emails they can use within Thunderbird Appointment"""
google_connections = get_by_type(db, subscriber_id=subscriber.id, type=ExternalConnectionType.google)

emails = {subscriber.email, *[connection.name for connection in google_connections]} - {subscriber.preferred_email}
Copy link
Member Author

Choose a reason for hiding this comment

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

This should ensure there's no duplicates if they already have their preferred email set as their main email, or a google account email.

Copy link
Collaborator

@devmount devmount left a comment

Choose a reason for hiding this comment

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

Thank you, works!

@devmount devmount merged commit 5991e5b into main May 31, 2024
4 checks passed
@devmount devmount deleted the features/408-preferred-email branch May 31, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n update A string has been added or needs updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change default email option
2 participants