diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-06-02 09:49:38 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-06-02 09:49:38 +0200 |
commit | 25a46d9e5999682f2a9bba3492f5497d1e0ce0bc (patch) | |
tree | 776495c28dcc1e75ceacdfcbe801ab7344978b88 /app/mailers | |
parent | c1d0a6a7981b5fe74bdd03c958a558096ea3cde8 (diff) | |
parent | 1485bd9b4bf407d1051a6b160d2530c9ca93f10b (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/styles/fonts/montserrat.scss`: Code style changes upstream, path changes in glitch-soc. Applied upstream's code style changes. - `app/javascript/styles/fonts/roboto-mono.scss`: Code style changes upstream, path changes in glitch-soc. Applied upstream's code style changes. - `app/javascript/styles/fonts/roboto.scss`: Code style changes upstream, path changes in glitch-soc. Applied upstream's code style changes. - `app/models/account.rb`: Textual conflict only caused by glitch-soc using a different value for character limits in a nearby line. Applied upstream's changes. - `app/views/statuses/_simple_status.html.haml`: Attribute added to a tag modified by glitch-soc. Added upstream's attributes. - `yarn.lock`: Upstream added/updated dependencies close to glitch-soc-only ones. Updated/added upstream dependencies.
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/user_mailer.rb | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index e47bedec6..09e2b7c53 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -18,7 +18,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.unconfirmed_email.presence || @resource.email, subject: I18n.t(@resource.pending_reconfirmation? ? 'devise.mailer.reconfirmation_instructions.subject' : 'devise.mailer.confirmation_instructions.subject', instance: @instance), template_name: @resource.pending_reconfirmation? ? 'reconfirmation_instructions' : 'confirmation_instructions' @@ -32,7 +32,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.reset_password_instructions.subject') end end @@ -43,7 +43,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.password_change.subject') end end @@ -54,7 +54,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.email_changed.subject') end end @@ -65,7 +65,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.two_factor_enabled.subject') end end @@ -76,7 +76,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.two_factor_disabled.subject') end end @@ -87,7 +87,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.two_factor_recovery_codes_changed.subject') end end @@ -98,7 +98,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.webauthn_enabled.subject') end end @@ -109,7 +109,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.webauthn_disabled.subject') end end @@ -121,7 +121,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.webauthn_credential.added.subject') end end @@ -133,7 +133,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('devise.mailer.webauthn_credential.deleted.subject') end end @@ -144,7 +144,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('user_mailer.welcome.subject') end end @@ -156,7 +156,7 @@ class UserMailer < Devise::Mailer return unless @resource.active_for_authentication? - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('user_mailer.backup_ready.subject') end end @@ -167,7 +167,7 @@ class UserMailer < Devise::Mailer @instance = Rails.configuration.x.local_domain @statuses = @warning.statuses.includes(:account, :preloadable_poll, :media_attachments, active_mentions: [:account]) - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t("user_mailer.warning.subject.#{@warning.action}", acct: "@#{user.account.local_username_and_domain}") end end @@ -177,7 +177,7 @@ class UserMailer < Devise::Mailer @instance = Rails.configuration.x.local_domain @appeal = appeal - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('user_mailer.appeal_approved.subject', date: l(@appeal.created_at)) end end @@ -187,7 +187,7 @@ class UserMailer < Devise::Mailer @instance = Rails.configuration.x.local_domain @appeal = appeal - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('user_mailer.appeal_rejected.subject', date: l(@appeal.created_at)) end end @@ -200,8 +200,14 @@ class UserMailer < Devise::Mailer @detection = Browser.new(user_agent) @timestamp = timestamp.to_time.utc - I18n.with_locale(@resource.locale || I18n.default_locale) do + I18n.with_locale(locale) do mail to: @resource.email, subject: I18n.t('user_mailer.suspicious_sign_in.subject') end end + + private + + def locale + @resource.locale.presence || I18n.default_locale + end end |