Skip to content

Commit

Permalink
Fix when MoveWorker cannot get locale from remote account (mastodon#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
noellabo authored and kadoshita committed Nov 6, 2021
1 parent ccc8956 commit 429b15e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/workers/move_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def queue_follow_unfollows!

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 || I18n.default_locale) do
I18n.t('move_handler.copy_account_note_text', acct: @source_account.acct)
end

Expand Down Expand Up @@ -84,7 +84,7 @@ def carry_mutes_over!

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 || I18n.default_locale) do
I18n.t(id, acct: @source_account.acct)
end
AccountNote.create!(account: account, target_account: @target_account, comment: text)
Expand Down

0 comments on commit 429b15e

Please sign in to comment.