-
Notifications
You must be signed in to change notification settings - Fork 122
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
Use a service class to send confirmation emails #2948
Conversation
**Why**: Because when the confirmation logic is moved out of the user model into the email address model having the user handling sending the notification won't make sense anymore.
# :reek:DuplicateMethodCall | ||
def email_address | ||
@email_address ||= begin | ||
raise handle_multiple_email_address_error if user.email_addresses.count > 1 |
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.
The raise
here is redundant
subject.call(request_id: request_id, instructions: instructions) | ||
end | ||
|
||
it 'creates updates the confirmation values on the email address for the user' do |
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.
Need to get rid of creates
here
@@ -9,6 +9,19 @@ def email_changed(old_email) | |||
mail(to: old_email, subject: t('mailer.email_change_notice.subject')) | |||
end | |||
|
|||
# :reek:ControlParameter | |||
# :reek:LongParameterList | |||
# :reek:TooManyStatements |
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.
I assume you want to leave in the 3 lines above. I am pointing this out in case you intended to remove them later.
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.
Yes, I meant to disable these. Normally I'd add a method for consuming the parameters, but this class is already pretty fat and I'd be worried about that getting lost in the concerns it has for the other mails it sends.
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.
Review comments above, otherwise 👍
Why: Because when the confirmation logic is moved out of the user model into the email address model having the user handling sending the notification won't make sense anymore.