-
Notifications
You must be signed in to change notification settings - Fork 18
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
Create user account email class #335
Conversation
The code for emailing a creation or invite email to a buyer or supplier is really similar. We're also moving these emails to Notify which also simplifies the process (no need for templates). This class can be imported by the frontend apps and used to generate and send the tokens and emails for user creation/invitiation.
dmutils/email/user_account_email.py
Outdated
from .helpers import hash_string | ||
|
||
|
||
class UserAccountEmail(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like this could be a function. Class attributes are essentially used as arguments for the single method.
Do you think this will get extended in the future in a way that would be easier to do with a class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have updated to not be a class, and have imported the external blueprint from the supplier frontend.
As part of moving the logic for sending user account emails to a shared place in utils, we can move the external blueprints from the supplier frontend here too, and then import it in the app if needed. Other apps external blueprints could be moved here too and shared.
0556bf4
to
8ab9bdc
Compare
This changes the logic to a function which can be imported and used in the apps. It also imports the external blueprint which has been moved to utils. This means all logic can live in the function instead of having to pass in the url as before.
8ab9bdc
to
2578841
Compare
The code for emailing a creation or invite email to a buyer or supplier
is really similar. We're also moving these emails to Notify which also
simplifies the process (no need for templates).
This class can be imported by the frontend apps and used to generate and
send the tokens and emails for user creation/invitiation.