mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 01:41:08 +00:00
Prefer delegated nil-wrapping methods to safe navigation (#35541)
This commit is contained in:
parent
b464b87c2b
commit
5d69157e62
|
@ -30,9 +30,9 @@
|
||||||
= t('admin.accounts.suspended')
|
= t('admin.accounts.suspended')
|
||||||
- elsif account.silenced?
|
- elsif account.silenced?
|
||||||
= t('admin.accounts.silenced')
|
= t('admin.accounts.silenced')
|
||||||
- elsif account.local? && account.user&.disabled?
|
- elsif account.local? && account.user_disabled?
|
||||||
= t('admin.accounts.disabled')
|
= t('admin.accounts.disabled')
|
||||||
- elsif account.local? && !account.user&.confirmed?
|
- elsif account.local? && !account.user_confirmed?
|
||||||
= t('admin.accounts.confirming')
|
= t('admin.accounts.confirming')
|
||||||
- elsif account.local? && !account.user_approved?
|
- elsif account.local? && !account.user_approved?
|
||||||
= t('admin.accounts.pending')
|
= t('admin.accounts.pending')
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
%tr
|
%tr
|
||||||
%th= t('admin.accounts.email_status')
|
%th= t('admin.accounts.email_status')
|
||||||
%td
|
%td
|
||||||
- if account.user&.confirmed?
|
- if account.user_confirmed?
|
||||||
= t('admin.accounts.confirmed')
|
= t('admin.accounts.confirmed')
|
||||||
- else
|
- else
|
||||||
= t('admin.accounts.confirming')
|
= t('admin.accounts.confirming')
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
%span.red= t('admin.accounts.suspended')
|
%span.red= t('admin.accounts.suspended')
|
||||||
- elsif target_account.silenced?
|
- elsif target_account.silenced?
|
||||||
%span.red= t('admin.accounts.silenced')
|
%span.red= t('admin.accounts.silenced')
|
||||||
- elsif target_account.user&.disabled?
|
- elsif target_account.user_disabled?
|
||||||
%span.red= t('admin.accounts.disabled')
|
%span.red= t('admin.accounts.disabled')
|
||||||
- else
|
- else
|
||||||
%span.neutral= t('admin.accounts.no_limits_imposed')
|
%span.neutral= t('admin.accounts.no_limits_imposed')
|
||||||
|
|
|
@ -81,7 +81,7 @@ class MoveWorker
|
||||||
|
|
||||||
def copy_account_notes!
|
def copy_account_notes!
|
||||||
AccountNote.where(target_account: @source_account).find_each do |note|
|
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)
|
I18n.t('move_handler.copy_account_note_text', acct: @source_account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class MoveWorker
|
||||||
|
|
||||||
def add_account_note_if_needed!(account, id)
|
def add_account_note_if_needed!(account, id)
|
||||||
unless AccountNote.exists?(account: account, target_account: @target_account)
|
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)
|
I18n.t(id, acct: @source_account.acct)
|
||||||
end
|
end
|
||||||
AccountNote.create!(account: account, target_account: @target_account, comment: text)
|
AccountNote.create!(account: account, target_account: @target_account, comment: text)
|
||||||
|
|
|
@ -9,7 +9,7 @@ class PublishScheduledStatusWorker
|
||||||
scheduled_status = ScheduledStatus.find(scheduled_status_id)
|
scheduled_status = ScheduledStatus.find(scheduled_status_id)
|
||||||
scheduled_status.destroy!
|
scheduled_status.destroy!
|
||||||
|
|
||||||
return true if scheduled_status.account.user.disabled?
|
return true if scheduled_status.account.user_disabled?
|
||||||
|
|
||||||
PostStatusService.new.call(
|
PostStatusService.new.call(
|
||||||
scheduled_status.account,
|
scheduled_status.account,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user