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

Use a service class to send confirmation emails #2948

Merged
merged 8 commits into from
May 16, 2019

Conversation

jmhooper
Copy link
Member

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.

**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
Copy link
Member Author

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

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
Copy link
Contributor

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.

Copy link
Member Author

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.

achapm
achapm previously approved these changes May 16, 2019
Copy link
Contributor

@achapm achapm left a 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 👍

@jmhooper jmhooper merged commit 4a9b939 into master May 16, 2019
@amathews-fs amathews-fs deleted the jmhooper-move-email-sending-off-of-user branch January 7, 2021 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants