glitch-soc/mastodon

View on GitHub
app/views/admin/reports/_header_details.html.haml

Summary

Maintainability
Test Coverage
.report-header__details
  .report-header__details__item
    .report-header__details__item__header
      %strong= t('admin.reports.created_at')
    .report-header__details__item__content
      %time.formatted{ datetime: report.created_at.iso8601 }
  .report-header__details__item
    .report-header__details__item__header
      %strong= t('admin.reports.reported_by')
    .report-header__details__item__content
      - if report.account.instance_actor?
        = site_hostname
      - elsif report.account.local?
        = admin_account_link_to report.account
      - else
        = report.account.domain
  - if report.application.present?
    .report-header__details__item
      .report-header__details__item__header
        %strong= t('admin.reports.reported_with_application')
      .report-header__details__item__content
        = report.application.name
  .report-header__details__item
    .report-header__details__item__header
      %strong= t('admin.reports.status')
    .report-header__details__item__content
      - if report.action_taken?
        = t('admin.reports.resolved')
      - else
        = t('admin.reports.unresolved')
  - if report.account.local? && !report.target_account.local?
    .report-header__details__item
      .report-header__details__item__header
        %strong= t('admin.reports.forwarded')
      .report-header__details__item__content
        - if report.forwarded?
          = t('simple_form.yes')
        - else
          = t('simple_form.no')
  - if report.action_taken_by_account.present?
    .report-header__details__item
      .report-header__details__item__header
        %strong= t('admin.reports.action_taken_by')
      .report-header__details__item__content
        = admin_account_link_to report.action_taken_by_account
  - else
    .report-header__details__item
      .report-header__details__item__header
        %strong= t('admin.reports.assigned')
      .report-header__details__item__content
        - if report.assigned_account.nil?
          = t 'admin.reports.no_one_assigned'
        - else
          = admin_account_link_to report.assigned_account
        —
        - if report.assigned_account != current_user.account
          = table_link_to 'person', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(report), method: :post
        - elsif !report.assigned_account.nil?
          = table_link_to 'delete', t('admin.reports.unassign'), unassign_admin_report_path(report), method: :post