Use Report#local? delegation more broadly (#37596)

This commit is contained in:
Matt Jankowski
2026-01-26 04:43:21 -05:00
committed by GitHub
parent f7a2e5c715
commit 876ccfe0a3
6 changed files with 12 additions and 8 deletions

View File

@@ -1,12 +1,12 @@
- if report.account.instance_actor?
%p= t('admin.reports.comment_description_html', name: content_tag(:strong, site_hostname, class: 'username'))
- elsif report.account.local?
- elsif report.local?
%p= t('admin.reports.comment_description_html', name: content_tag(:strong, report.account.username, class: 'username'))
- else
%p= t('admin.reports.comment_description_html', name: t('admin.reports.remote_user_placeholder', instance: report.account.domain))
.report-notes
.report-notes__item
- if report.account.local? && !report.account.instance_actor?
- if report.local? && !report.account.instance_actor?
= image_tag report.account.avatar.url, class: 'report-notes__item__avatar'
- else
= image_tag(full_asset_url('avatars/original/missing.png', skip_pipeline: true), class: 'report-notes__item__avatar')
@@ -14,7 +14,7 @@
%span.username
- if report.account.instance_actor?
= site_hostname
- elsif report.account.local?
- elsif report.local?
= link_to report.account.username, admin_account_path(report.account_id)
- else
= link_to report.account.domain, admin_instance_path(report.account.domain)

View File

@@ -10,7 +10,7 @@
.report-header__details__item__content
- if report.account.instance_actor?
= site_hostname
- elsif report.account.local?
- elsif report.local?
= admin_account_link_to report.account
- else
= report.account.domain
@@ -28,7 +28,7 @@
= t('admin.reports.resolved')
- else
= t('admin.reports.unresolved')
- if report.account.local? && !report.target_account.local?
- if report.local? && !report.target_account.local?
.report-header__details__item
.report-header__details__item__header
%strong= t('admin.reports.forwarded')

View File

@@ -51,7 +51,7 @@
.report-card__summary__item__reported-by
- if report.account.instance_actor?
= site_hostname
- elsif report.account.local?
- elsif report.local?
= admin_account_link_to report.account
- else
= report.account.domain

View File

@@ -7,7 +7,7 @@
- else
= link_to t('admin.reports.mark_as_unresolved'), reopen_admin_report_path(@report), method: :post, class: 'button'
- unless @report.account.local? || @report.target_account.local?
- unless @report.local? || @report.target_account.local?
.flash-message= t('admin.reports.forwarded_replies_explanation')
.report-header

View File

@@ -1,3 +1,3 @@
<%= raw(@report.account.local? ? t('admin_mailer.new_report.body', target: @report.target_account.pretty_acct, reporter: @report.account.pretty_acct) : t('admin_mailer.new_report.body_remote', target: @report.target_account.acct, domain: @report.account.domain)) %>
<%= raw(@report.local? ? t('admin_mailer.new_report.body', target: @report.target_account.pretty_acct, reporter: @report.account.pretty_acct) : t('admin_mailer.new_report.body_remote', target: @report.target_account.acct, domain: @report.account.domain)) %>
<%= raw t('application_mailer.view')%> <%= admin_report_url(@report) %>

View File

@@ -156,6 +156,10 @@ RSpec.describe Report do
end
end
describe 'Delegations' do
it { is_expected.to delegate_method(:local?).to(:account) }
end
describe 'Validations' do
let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }