Skip to content

LG-5847: Update confirmation email language#8079

Merged
jc-gsa merged 3 commits intomainfrom
LG-5847-confirmation-email-language
Mar 28, 2023
Merged

LG-5847: Update confirmation email language#8079
jc-gsa merged 3 commits intomainfrom
LG-5847-confirmation-email-language

Conversation

@jc-gsa
Copy link
Contributor

@jc-gsa jc-gsa commented Mar 27, 2023

🎫 Ticket

LG-5847

🛠 Summary of changes

To reproduce:

  • Register a new account but do not confirm the account, note the language selected
  • Register an account using the same email address as before and change the language preference
  • Notice that the second email arrives in the desired language

jc-gsa added 2 commits March 23, 2023 14:17
changelog: User-Facing Improvements, Registration, Update user confirmation email language
@jc-gsa jc-gsa force-pushed the LG-5847-confirmation-email-language branch from 13adda5 to cb84af8 Compare March 27, 2023 19:56
@jc-gsa jc-gsa requested a review from a team March 27, 2023 22:45
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines +103 to +105
if existing_user.email_language != email_language
existing_user.update(email_language: email_language)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I was curious if ActiveRecord was smart enough to avoid a database query if the value is unchanged, and based on some quick testing in a Rails console, it seems like it is? Keeping it as-is is fine too if the condition helps make it more explicit.

[2] pry(main)> u.email_language
=> "en"
[3] pry(main)> u.update(email_language: 'en')
=> true
[4] pry(main)> u.update(email_language: 'fr')
  TRANSACTION (0.5ms)  BEGIN
  User Update (3.0ms)  UPDATE "users" SET "updated_at" = $1, "email_language" = $2 WHERE "users"."id" = $3  [["updated_at", "2023-03-28 12:55:15.383464"], ["email_language", "fr"], ["id", 22]]
  TRANSACTION (2.1ms)  COMMIT
=> true
Suggested change
if existing_user.email_language != email_language
existing_user.update(email_language: email_language)
end
existing_user.update(email_language: email_language)

@jc-gsa jc-gsa merged commit c3e590f into main Mar 28, 2023
@jc-gsa jc-gsa deleted the LG-5847-confirmation-email-language branch March 28, 2023 13:43
@aduth aduth mentioned this pull request Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants