Skip to content

Commit

Permalink
AO3-4302 i18n change the email address (#2117)
Browse files Browse the repository at this point in the history
* change the email address

* Try the new locale keys

* Remove extra spaces

* translation missing not translation_missing
  • Loading branch information
zz9pzza authored and sarken committed Jan 18, 2017
1 parent 647ba62 commit ef9ce90
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def change_email(user_id, old_email, new_email)
I18n.with_locale(Locale.find(@user.preference.preferred_locale).iso) do
mail(
to: @old_email,
subject: "[#{ArchiveConfig.APP_SHORT_NAME}] Email changed"
subject: t('user_mailer.change_email.subject', app_name: ArchiveConfig.APP_SHORT_NAME)
)
end
ensure
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_mailer/change_email.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<% content_for :message do %>
<%= style_bold(@user.login) %>, the email associated with your account has been changed to <%= style_email(@user.email) %>.
<%= t('.part1', login: style_bold(@user.login), email: style_email(@user.email)).html_safe %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/user_mailer/change_email.text.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<% content_for :message do %>
<%= @user.login %>, the email associated with your account has been changed to <%= @user.email %>.
<%= t('.part1', login: @user.login, email: @user.email) %>
<% end %>
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ en:
friend at %{invitation_page}.
Cheers,
%{archive_name}
change_email:
subject: "[%{app_name}] Email changed"
part1: "%{login}, the email associated with your account has been changed to %{email}"
reset_password:
subject: "[%{app_name}] Generated password"
part1: "%{user}, the following generated password has been created for you: %{password}"
Expand Down
3 changes: 3 additions & 0 deletions features/other_a/profile_edit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Scenario: Edit profile - Changing email address and viewing
When I change my email
Then I should see "Your email has been successfully updated"
And 1 email should be delivered to "bar@ao3.org"
And the email should contain "the email associated with your account has been changed to"
And the email should contain "valid2@archiveofourown.org"
And the email should not contain "translation missing"
When I change my preferences to display my email address
Then I should see "My email address: valid2@archiveofourown.org"

Expand Down

0 comments on commit ef9ce90

Please sign in to comment.