about summary refs log tree commit diff
path: root/app/workers/move_worker.rb
diff options
context:
space:
mode:
authorJeong Arm <kjwonmail@gmail.com>2022-05-28 21:32:08 +0900
committerGitHub <noreply@github.com>2022-05-28 14:32:08 +0200
commitfed7380e9f6811ac069b1891546581aa4bccb122 (patch)
treef22825ef635931f3e87e2bc702e11de6fdfc44df /app/workers/move_worker.rb
parent0ac6e5d434f9d24a5d9fb3865acd4ced0bb1bf02 (diff)
Prevent use locale with empty string (#18543)
Somehow user's locale could be an empty string, And empty string itself
are treated as true value.
Diffstat (limited to 'app/workers/move_worker.rb')
-rw-r--r--app/workers/move_worker.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/workers/move_worker.rb b/app/workers/move_worker.rb
index 4a900e3b8..c3167f9ca 100644
--- a/app/workers/move_worker.rb
+++ b/app/workers/move_worker.rb
@@ -47,7 +47,7 @@ class MoveWorker
 
   def copy_account_notes!
     AccountNote.where(target_account: @source_account).find_each do |note|
-      text = I18n.with_locale(note.account.user&.locale || I18n.default_locale) do
+      text = I18n.with_locale(note.account.user&.locale.presence || I18n.default_locale) do
         I18n.t('move_handler.copy_account_note_text', acct: @source_account.acct)
       end
 
@@ -90,7 +90,7 @@ class MoveWorker
 
   def add_account_note_if_needed!(account, id)
     unless AccountNote.where(account: account, target_account: @target_account).exists?
-      text = I18n.with_locale(account.user&.locale || I18n.default_locale) do
+      text = I18n.with_locale(account.user&.locale.presence || I18n.default_locale) do
         I18n.t(id, acct: @source_account.acct)
       end
       AccountNote.create!(account: account, target_account: @target_account, comment: text)