show.html.haml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. - content_for :header_tags do
  2. = javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
  3. = javascript_pack_tag 'public', async: true, crossorigin: 'anonymous'
  4. - content_for :page_title do
  5. = t('admin.reports.report', id: @report.id)
  6. - content_for :heading_actions do
  7. - if @report.unresolved?
  8. = link_to t('admin.reports.mark_as_resolved'), resolve_admin_report_path(@report), method: :post, class: 'button'
  9. - else
  10. = link_to t('admin.reports.mark_as_unresolved'), reopen_admin_report_path(@report), method: :post, class: 'button'
  11. .report-header
  12. .report-header__card
  13. .account-card
  14. .account-card__header
  15. = image_tag @report.target_account.header.url, alt: ''
  16. .account-card__title
  17. .account-card__title__avatar
  18. = image_tag @report.target_account.avatar.url, alt: ''
  19. .display-name
  20. %bdi
  21. %strong.emojify.p-name= display_name(@report.target_account, custom_emojify: true)
  22. %span
  23. = acct(@report.target_account)
  24. = fa_icon('lock') if @report.target_account.locked?
  25. - if @report.target_account.note.present?
  26. .account-card__bio.emojify
  27. = prerender_custom_emojis(account_bio_format(@report.target_account), @report.target_account.emojis)
  28. .account-card__actions
  29. .account-card__counters
  30. .account-card__counters__item
  31. = friendly_number_to_human @report.target_account.statuses_count
  32. %small= t('accounts.posts', count: @report.target_account.statuses_count).downcase
  33. .account-card__counters__item
  34. = friendly_number_to_human @report.target_account.followers_count
  35. %small= t('accounts.followers', count: @report.target_account.followers_count).downcase
  36. .account-card__counters__item
  37. = friendly_number_to_human @report.target_account.following_count
  38. %small= t('accounts.following', count: @report.target_account.following_count).downcase
  39. .account-card__actions__button
  40. = link_to t('admin.reports.view_profile'), admin_account_path(@report.target_account_id), class: 'button'
  41. .report-header__details.report-header__details--horizontal
  42. .report-header__details__item
  43. .report-header__details__item__header
  44. %strong= t('admin.accounts.joined')
  45. .report-header__details__item__content
  46. %time.time-ago{ datetime: @report.target_account.created_at.iso8601, title: l(@report.target_account.created_at) }= l @report.target_account.created_at
  47. .report-header__details__item
  48. .report-header__details__item__header
  49. %strong= t('accounts.last_active')
  50. .report-header__details__item__content
  51. - if @report.target_account.last_status_at.present?
  52. %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
  53. .report-header__details__item
  54. .report-header__details__item__header
  55. %strong= t('admin.accounts.strikes')
  56. .report-header__details__item__content
  57. = @report.target_account.previous_strikes_count
  58. .report-header__details
  59. .report-header__details__item
  60. .report-header__details__item__header
  61. %strong= t('admin.reports.created_at')
  62. .report-header__details__item__content
  63. %time.formatted{ datetime: @report.created_at.iso8601 }
  64. .report-header__details__item
  65. .report-header__details__item__header
  66. %strong= t('admin.reports.reported_by')
  67. .report-header__details__item__content
  68. - if @report.account.instance_actor?
  69. = site_hostname
  70. - elsif @report.account.local?
  71. = admin_account_link_to @report.account
  72. - else
  73. = @report.account.domain
  74. .report-header__details__item
  75. .report-header__details__item__header
  76. %strong= t('admin.reports.status')
  77. .report-header__details__item__content
  78. - if @report.action_taken?
  79. = t('admin.reports.resolved')
  80. - else
  81. = t('admin.reports.unresolved')
  82. - unless @report.target_account.local?
  83. .report-header__details__item
  84. .report-header__details__item__header
  85. %strong= t('admin.reports.forwarded')
  86. .report-header__details__item__content
  87. - if @report.forwarded?
  88. = t('simple_form.yes')
  89. - else
  90. = t('simple_form.no')
  91. - if !@report.action_taken_by_account.nil?
  92. .report-header__details__item
  93. .report-header__details__item__header
  94. %strong= t('admin.reports.action_taken_by')
  95. .report-header__details__item__content
  96. = admin_account_link_to @report.action_taken_by_account
  97. - else
  98. .report-header__details__item
  99. .report-header__details__item__header
  100. %strong= t('admin.reports.assigned')
  101. .report-header__details__item__content
  102. - if @report.assigned_account.nil?
  103. = t 'admin.reports.no_one_assigned'
  104. - else
  105. = admin_account_link_to @report.assigned_account
  106. - if @report.assigned_account != current_user.account
  107. = table_link_to 'user', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(@report), method: :post
  108. - elsif !@report.assigned_account.nil?
  109. = table_link_to 'trash', t('admin.reports.unassign'), unassign_admin_report_path(@report), method: :post
  110. %hr.spacer
  111. %h3= t 'admin.reports.category'
  112. %p= t 'admin.reports.category_description_html'
  113. = react_admin_component :report_reason_selector, id: @report.id, category: @report.category, rule_ids: @report.rule_ids&.map(&:to_s), disabled: @report.action_taken?
  114. - if @report.comment.present?
  115. - if @report.account.instance_actor?
  116. %p= t('admin.reports.comment_description_html', name: content_tag(:strong, site_hostname, class: 'username'))
  117. - elsif @report.account.local?
  118. %p= t('admin.reports.comment_description_html', name: content_tag(:strong, @report.account.username, class: 'username'))
  119. - else
  120. %p= t('admin.reports.comment_description_html', name: t('admin.reports.remote_user_placeholder', instance: @report.account.domain))
  121. .report-notes
  122. .report-notes__item
  123. - if @report.account.local? && !@report.account.instance_actor?
  124. = image_tag @report.account.avatar.url, class: 'report-notes__item__avatar'
  125. - else
  126. = image_tag(full_asset_url('avatars/original/missing.png', skip_pipeline: true), class: 'report-notes__item__avatar')
  127. .report-notes__item__header
  128. %span.username
  129. - if @report.account.instance_actor?
  130. = site_hostname
  131. - elsif @report.account.local?
  132. = link_to @report.account.username, admin_account_path(@report.account_id)
  133. - else
  134. = link_to @report.account.domain, admin_instance_path(@report.account.domain)
  135. %time{ datetime: @report.created_at.iso8601, title: l(@report.created_at) }
  136. - if @report.created_at.today?
  137. = t('admin.report_notes.today_at', time: l(@report.created_at, format: :time))
  138. - else
  139. = l @report.created_at.to_date
  140. .report-notes__item__content
  141. = simple_format(h(@report.comment))
  142. %hr.spacer/
  143. %h3
  144. = t 'admin.reports.statuses'
  145. %small.section-skip-link
  146. = link_to '#actions' do
  147. = fa_icon 'angle-double-down'
  148. = t('admin.reports.skip_to_actions')
  149. %p
  150. = t 'admin.reports.statuses_description_html'
  151. = 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'
  152. = form_for(@form, url: batch_admin_account_statuses_path(@report.target_account_id, report_id: @report.id)) do |f|
  153. .batch-table
  154. .batch-table__toolbar
  155. %label.batch-table__toolbar__select.batch-checkbox-all
  156. = check_box_tag :batch_checkbox_all, nil, false
  157. .batch-table__toolbar__actions
  158. - if !@statuses.empty? && @report.unresolved?
  159. = f.button safe_join([fa_icon('times'), t('admin.statuses.batch.remove_from_report')]), name: :remove_from_report, class: 'table-action-link', type: :submit
  160. .batch-table__body
  161. - if @statuses.empty?
  162. = nothing_here 'nothing-here--under-tabs'
  163. - else
  164. = render partial: 'admin/reports/status', collection: @statuses, locals: { f: f }
  165. - if @report.unresolved?
  166. %hr.spacer/
  167. %p#actions= t 'admin.reports.actions_description_html'
  168. = render partial: 'admin/reports/actions'
  169. - unless @action_logs.empty?
  170. %hr.spacer/
  171. %h3= t 'admin.reports.action_log'
  172. .report-notes
  173. = render @action_logs
  174. %hr.spacer/
  175. %h3= t 'admin.reports.notes.title'
  176. %p= t 'admin.reports.notes_description_html'
  177. .report-notes
  178. = render @report_notes
  179. = simple_form_for @report_note, url: admin_report_notes_path do |f|
  180. = f.input :report_id, as: :hidden
  181. .field-group
  182. = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6
  183. .actions
  184. - if @report.unresolved?
  185. = f.button :button, t('admin.reports.notes.create_and_resolve'), name: :create_and_resolve, type: :submit
  186. - else
  187. = f.button :button, t('admin.reports.notes.create_and_unresolve'), name: :create_and_unresolve, type: :submit
  188. = f.button :button, t('admin.reports.notes.create'), type: :submit