Prefer delegated nil-wrapping methods to safe navigation (#35541)

This commit is contained in:
Matt Jankowski 2025-07-28 04:03:23 -04:00 committed by GitHub
parent b464b87c2b
commit 5d69157e62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 7 deletions

View File

@ -30,9 +30,9 @@
= t('admin.accounts.suspended')
- elsif account.silenced?
= t('admin.accounts.silenced')
- elsif account.local? && account.user&.disabled?
- elsif account.local? && account.user_disabled?
= t('admin.accounts.disabled')
- elsif account.local? && !account.user&.confirmed?
- elsif account.local? && !account.user_confirmed?
= t('admin.accounts.confirming')
- elsif account.local? && !account.user_approved?
= t('admin.accounts.pending')

View File

@ -34,7 +34,7 @@
%tr
%th= t('admin.accounts.email_status')
%td
- if account.user&.confirmed?
- if account.user_confirmed?
= t('admin.accounts.confirmed')
- else
= t('admin.accounts.confirming')

View File

@ -42,7 +42,7 @@
%span.red= t('admin.accounts.suspended')
- elsif target_account.silenced?
%span.red= t('admin.accounts.silenced')
- elsif target_account.user&.disabled?
- elsif target_account.user_disabled?
%span.red= t('admin.accounts.disabled')
- else
%span.neutral= t('admin.accounts.no_limits_imposed')

View File

@ -81,7 +81,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.presence || 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
@ -124,7 +124,7 @@ class MoveWorker
def add_account_note_if_needed!(account, id)
unless AccountNote.exists?(account: account, target_account: @target_account)
text = I18n.with_locale(account.user&.locale.presence || 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)

View File

@ -9,7 +9,7 @@ class PublishScheduledStatusWorker
scheduled_status = ScheduledStatus.find(scheduled_status_id)
scheduled_status.destroy!
return true if scheduled_status.account.user.disabled?
return true if scheduled_status.account.user_disabled?
PostStatusService.new.call(
scheduled_status.account,