about summary refs log tree commit diff
path: root/app/views/admin/reports/show.html.haml
blob: e5ea56779de3f9d98e00045f7a693805ab260e20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
- content_for :page_title do
  = t('admin.reports.report', id: @report.id)

- content_for :heading_actions do
  - if @report.unresolved?
    = link_to t('admin.reports.mark_as_resolved'), resolve_admin_report_path(@report), method: :post, class: 'button'
  - else
    = link_to t('admin.reports.mark_as_unresolved'), reopen_admin_report_path(@report), method: :post, class: 'button'

.report-header
  .report-header__card
    .account-card
      .account-card__header
        = image_tag @report.target_account.header.url, alt: ''
      .account-card__title
        .account-card__title__avatar
          = image_tag @report.target_account.avatar.url, alt: ''
        .display-name
          %bdi
            %strong.emojify.p-name= display_name(@report.target_account, custom_emojify: true)
          %span
            = acct(@report.target_account)
            = fa_icon('lock') if @report.target_account.locked?
      - if @report.target_account.note.present?
        .account-card__bio.emojify
          = prerender_custom_emojis(account_bio_format(@report.target_account), @report.target_account.emojis)
      .account-card__actions
        .account-card__counters
          .account-card__counters__item
            = friendly_number_to_human @report.target_account.statuses_count
            %small= t('accounts.posts', count: @report.target_account.statuses_count).downcase
          .account-card__counters__item
            = friendly_number_to_human @report.target_account.followers_count
            %small= t('accounts.followers', count: @report.target_account.followers_count).downcase
          .account-card__counters__item
            = friendly_number_to_human @report.target_account.following_count
            %small= t('accounts.following', count: @report.target_account.following_count).downcase
        .account-card__actions__button
          = link_to t('admin.reports.view_profile'), admin_account_path(@report.target_account_id), class: 'button'
    .report-header__details.report-header__details--horizontal
      .report-header__details__item
        .report-header__details__item__header
          %strong= t('admin.accounts.joined')
        .report-header__details__item__content
          %time.time-ago{ datetime: @report.target_account.created_at.iso8601, title: l(@report.target_account.created_at) }= l @report.target_account.created_at
      .report-header__details__item
        .report-header__details__item__header
          %strong= t('accounts.last_active')
        .report-header__details__item__content
          - if @report.target_account.last_status_at.present?
            %time.time-ago{ datetime: @report.target_account.last_status_at.to_date.iso8601, title: l(@report.target_account.last_status_at.to_date) }= l @report.target_account.last_status_at
      .report-header__details__item
        .report-header__details__item__header
          %strong= t('admin.accounts.strikes')
        .report-header__details__item__content
          = @report.target_account.previous_strikes_count

  .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
    .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')
    - unless @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.nil?
      .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 'user', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(@report), method: :post
          - elsif !@report.assigned_account.nil?
            = table_link_to 'trash', t('admin.reports.unassign'), unassign_admin_report_path(@report), method: :post

%hr.spacer

%h3= t 'admin.reports.category'

%p= t 'admin.reports.category_description_html'

= react_admin_component :report_reason_selector, id: @report.id, category: @report.category, rule_ids: @report.rule_ids&.map(&:to_s), disabled: @report.action_taken?

- if @report.comment.present?
  - if @report.account.instance_actor?
    %p= t('admin.reports.comment_description_html', name: content_tag(:strong, site_hostname, class: 'username'))
  - elsif @report.account.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?
        = 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')

      .report-notes__item__header
        %span.username
          - if @report.account.instance_actor?
            = site_hostname
          - elsif @report.account.local?
            = link_to @report.account.username, admin_account_path(@report.account_id)
          - else
            = link_to @report.account.domain, admin_instance_path(@report.account.domain)
        %time{ datetime: @report.created_at.iso8601, title: l(@report.created_at) }
          - if @report.created_at.today?
            = t('admin.report_notes.today_at', time: l(@report.created_at, format: :time))
          - else
            = l @report.created_at.to_date

      .report-notes__item__content
        = simple_format(h(@report.comment))

%hr.spacer/

%h3
  = t 'admin.reports.statuses'
  %small.section-skip-link
    = link_to '#actions' do
      = fa_icon 'angle-double-down'
      = t('admin.reports.skip_to_actions')

%p
  = t 'admin.reports.statuses_description_html'
  —
  = link_to safe_join([fa_icon('plus'), t('admin.reports.add_to_report')]), admin_account_statuses_path(@report.target_account_id, report_id: @report.id), class: 'table-action-link'

= form_for(@form, url: batch_admin_account_statuses_path(@report.target_account_id, report_id: @report.id)) do |f|
  .batch-table
    .batch-table__toolbar
      %label.batch-table__toolbar__select.batch-checkbox-all
        = check_box_tag :batch_checkbox_all, nil, false
      .batch-table__toolbar__actions
        - if !@statuses.empty? && @report.unresolved?
          = f.button safe_join([fa_icon('times'), t('admin.statuses.batch.remove_from_report')]), name: :remove_from_report, class: 'table-action-link', type: :submit
    .batch-table__body
      - if @statuses.empty?
        = nothing_here 'nothing-here--under-tabs'
      - else
        = render partial: 'admin/reports/status', collection: @statuses, locals: { f: f }

- if @report.unresolved?
  %hr.spacer/

  %p#actions= t 'admin.reports.actions_description_html'

  = render partial: 'admin/reports/actions'

- unless @action_logs.empty?
  %hr.spacer/

  %h3= t 'admin.reports.action_log'

  .report-notes
    = render @action_logs

%hr.spacer/

%h3= t 'admin.reports.notes.title'

%p= t 'admin.reports.notes_description_html'

.report-notes
  = render @report_notes

= simple_form_for @report_note, url: admin_report_notes_path do |f|
  = f.input :report_id, as: :hidden

  .field-group
    = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6

  .actions
    - if @report.unresolved?
      = f.button :button, t('admin.reports.notes.create_and_resolve'), name: :create_and_resolve, type: :submit
    - else
      = f.button :button, t('admin.reports.notes.create_and_unresolve'), name: :create_and_unresolve, type: :submit
    = f.button :button, t('admin.reports.notes.create'), type: :submit