-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Change behavior to skip reconfirmation after creating a record with #save called in callback #4125
Conversation
…save called in callback
@@ -165,6 +166,12 @@ def skip_reconfirmation! | |||
|
|||
protected | |||
|
|||
# To not require reoncfirmation after creating with #save called in a |
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.
A little typo here reconfirmation
Looks good to me. Any consideration @josevalim @lucasmazza I think it may need a backport to |
@@ -165,6 +166,12 @@ def skip_reconfirmation! | |||
|
|||
protected | |||
|
|||
# To not require reconfirmation after creating with #save called in a | |||
# callback call skip_create_confirmation! | |||
def skip_create_confirmation! |
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.
@ArneZsng @ulissesalmeida I feel like we should have better names to express the checks for dealing with the save + after_create scenarios - skip_create_confirmation
sounds like we are skipping the confirmation on a regular create scenario, regardless of the callback issue.
@lucasmazza I updated the naming to |
@lucasmazza @ulissesalmeida Looks good to you now? |
@lucasmazza @ulissesalmeida Anything outstanding from your side? |
|
@ArneZsng thanks for the patch, and sorry for the delay 😬 |
The following commit was breaking stuff on our system for a new email confirmation when the email is changed while the object is still in memory:
1d57169
This is due to
skip_reconfirmation!
insend_on_create_confirmation_instructions
because it sets@bypass_confirmation_postpone
to true which letspostpone_email_change?
return false.The case was added to the confirmable test case. Basically, the skipping of the reconfirmation as part of an after_create hook needs to be treated differently from a general bypass. To ensure that this is skipped when save is called in an after_create hook but NOT if the email is changed from an existing email, additional checks were added.