show.html.haml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. - content_for :page_title do
  2. = @account.pretty_acct
  3. - if @account.instance_actor?
  4. .flash-message.notice
  5. %strong= t('accounts.instance_actor_flash')
  6. = render 'application/card', account: @account
  7. - account = @account
  8. - fields = account.fields
  9. - unless fields.empty? && account.note.blank?
  10. .admin-account-bio
  11. - unless fields.empty?
  12. %div
  13. .account__header__fields
  14. - fields.each do |field|
  15. %dl
  16. %dt.emojify{ title: field.name }= prerender_custom_emojis(h(field.name), account.emojis)
  17. %dd{ title: field.value, class: custom_field_classes(field) }
  18. - if field.verified?
  19. %span.verified__mark{ title: t('accounts.link_verified_on', date: l(field.verified_at)) }
  20. = fa_icon 'check'
  21. = prerender_custom_emojis(account_field_value_format(field, with_rel_me: false), account.emojis)
  22. - if account.note.present?
  23. %div
  24. .account__header__content.emojify= prerender_custom_emojis(account_bio_format(account), account.emojis)
  25. .dashboard__counters.admin-account-counters
  26. %div
  27. = link_to admin_account_statuses_path(@account.id) do
  28. .dashboard__counters__num= number_with_delimiter @account.statuses_count
  29. .dashboard__counters__label= t 'admin.accounts.statuses'
  30. %div
  31. = link_to admin_account_statuses_path(@account.id, { media: true }) do
  32. .dashboard__counters__num= number_to_human_size @account.media_attachments.sum('file_file_size')
  33. .dashboard__counters__label= t 'admin.accounts.media_attachments'
  34. %div
  35. = link_to admin_account_relationships_path(@account.id, location: 'local', relationship: 'followed_by') do
  36. .dashboard__counters__num= number_with_delimiter @account.local_followers_count
  37. .dashboard__counters__label= t 'admin.accounts.followers'
  38. %div
  39. = link_to admin_reports_path(account_id: @account.id) do
  40. .dashboard__counters__num= number_with_delimiter @account.reports.count
  41. .dashboard__counters__label= t '.created_reports'
  42. %div
  43. = link_to admin_reports_path(target_account_id: @account.id) do
  44. .dashboard__counters__num= number_with_delimiter @account.targeted_reports.count
  45. .dashboard__counters__label= t '.targeted_reports'
  46. %div
  47. = link_to admin_action_logs_path(target_account_id: @account.id) do
  48. .dashboard__counters__text
  49. - if @account.local? && @account.user.nil?
  50. = t('admin.accounts.deleted')
  51. - elsif @account.memorial?
  52. = t('admin.accounts.memorialized')
  53. - elsif @account.suspended?
  54. = t('admin.accounts.suspended')
  55. - elsif @account.silenced?
  56. = t('admin.accounts.silenced')
  57. - elsif @account.local? && @account.user&.disabled?
  58. = t('admin.accounts.disabled')
  59. - elsif @account.local? && !@account.user&.confirmed?
  60. = t('admin.accounts.confirming')
  61. - elsif @account.local? && !@account.user_approved?
  62. = t('admin.accounts.pending')
  63. - elsif @account.sensitized?
  64. = t('admin.accounts.sensitive')
  65. - else
  66. = t('admin.accounts.no_limits_imposed')
  67. .dashboard__counters__label= t 'admin.accounts.login_status'
  68. - if @account.local? && @account.user.nil?
  69. = link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.where(reference_account_id: @account.id).exists?
  70. - else
  71. .table-wrapper
  72. %table.table.inline-table
  73. %tbody
  74. - if @account.local?
  75. - if @account.avatar?
  76. %tr
  77. %th= t('admin.accounts.avatar')
  78. %td= table_link_to 'trash', t('admin.accounts.remove_avatar'), remove_avatar_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:remove_avatar, @account)
  79. %td
  80. - if @account.header?
  81. %tr
  82. %th= t('admin.accounts.header')
  83. %td= table_link_to 'trash', t('admin.accounts.remove_header'), remove_header_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:remove_header, @account)
  84. %td
  85. %tr
  86. %th= t('admin.accounts.role')
  87. %td
  88. - if @account.user_role&.everyone?
  89. = t('admin.accounts.no_role_assigned')
  90. - else
  91. = @account.user_role&.name
  92. %td
  93. = table_link_to 'vcard', t('admin.accounts.change_role.label'), admin_user_role_path(@account.user) if can?(:change_role, @account.user)
  94. %tr
  95. %th{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= t('admin.accounts.email')
  96. %td{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= @account.user_email
  97. %td= table_link_to 'edit', t('admin.accounts.change_email.label'), admin_account_change_email_path(@account.id) if can?(:change_email, @account.user)
  98. %tr
  99. %td= table_link_to 'search', t('admin.accounts.search_same_email_domain'), admin_accounts_path(email: "%@#{@account.user_email.split('@').last}")
  100. - if can?(:create, :email_domain_block)
  101. %tr
  102. %td= table_link_to 'ban', t('admin.accounts.add_email_domain_block'), new_admin_email_domain_block_path(_domain: @account.user_email.split('@').last)
  103. - if @account.user_unconfirmed_email.present?
  104. %tr
  105. %th= t('admin.accounts.unconfirmed_email')
  106. %td= @account.user_unconfirmed_email
  107. %td
  108. %tr
  109. %th= t('admin.accounts.email_status')
  110. %td
  111. - if @account.user&.confirmed?
  112. = t('admin.accounts.confirmed')
  113. - else
  114. = t('admin.accounts.confirming')
  115. %td= table_link_to 'refresh', t('admin.accounts.resend_confirmation.send'), resend_admin_account_confirmation_path(@account.id), method: :post if can?(:confirm, @account.user)
  116. %tr
  117. %th{ rowspan: can?(:reset_password, @account.user) ? 2 : 1 }= t('admin.accounts.security')
  118. %td{ rowspan: can?(:reset_password, @account.user) ? 2 : 1 }
  119. - if @account.user&.two_factor_enabled?
  120. = t 'admin.accounts.security_measures.password_and_2fa'
  121. - else
  122. = t 'admin.accounts.security_measures.only_password'
  123. %td
  124. - if @account.user&.two_factor_enabled?
  125. = table_link_to 'unlock', t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(@account.user.id), method: :delete if can?(:disable_2fa, @account.user)
  126. - if can?(:reset_password, @account.user)
  127. %tr
  128. %td
  129. = table_link_to 'key', t('admin.accounts.reset_password'), admin_account_reset_path(@account.id), method: :create, data: { confirm: t('admin.accounts.are_you_sure') }
  130. %tr
  131. %th= t('simple_form.labels.defaults.locale')
  132. %td= standard_locale_name(@account.user_locale)
  133. %td
  134. %tr
  135. %th= t('admin.accounts.joined')
  136. %td
  137. %time.formatted{ datetime: @account.created_at.iso8601, title: l(@account.created_at) }= l @account.created_at
  138. %td
  139. - recent_ips = @account.user.ips.order(used_at: :desc).to_a
  140. - recent_ips.each_with_index do |recent_ip, i|
  141. %tr
  142. - if i.zero?
  143. %th{ rowspan: recent_ips.size }= t('admin.accounts.most_recent_ip')
  144. %td= recent_ip.ip
  145. %td= table_link_to 'search', t('admin.accounts.search_same_ip'), admin_accounts_path(ip: recent_ip.ip)
  146. %tr
  147. %th= t('admin.accounts.most_recent_activity')
  148. %td
  149. - if @account.user_current_sign_in_at
  150. %time.formatted{ datetime: @account.user_current_sign_in_at.iso8601, title: l(@account.user_current_sign_in_at) }= l @account.user_current_sign_in_at
  151. %td
  152. - if @account.user&.invited?
  153. %tr
  154. %th= t('admin.accounts.invited_by')
  155. %td= admin_account_link_to @account.user.invite.user.account
  156. %td
  157. - else
  158. %tr
  159. %th= t('admin.accounts.inbox_url')
  160. %td
  161. = @account.inbox_url
  162. = fa_icon DeliveryFailureTracker.available?(@account.inbox_url) ? 'check' : 'times'
  163. %td
  164. = table_link_to 'search', @domain_block.present? ? t('admin.domain_blocks.view') : t('admin.accounts.view_domain'), admin_instance_path(@account.domain)
  165. %tr
  166. %th= t('admin.accounts.shared_inbox_url')
  167. %td
  168. = @account.shared_inbox_url
  169. = fa_icon DeliveryFailureTracker.available?(@account.shared_inbox_url) ? 'check': 'times'
  170. %td
  171. - if @domain_block.nil?
  172. = table_link_to 'ban', t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @account.domain)
  173. - if @account.suspended?
  174. %hr.spacer/
  175. - if @account.suspension_origin_remote?
  176. %p.muted-hint= @deletion_request.present? ? t('admin.accounts.remote_suspension_reversible_hint_html', date: content_tag(:strong, l(@deletion_request.due_at.to_date))) : t('admin.accounts.remote_suspension_irreversible')
  177. - else
  178. %p.muted-hint= @deletion_request.present? ? t('admin.accounts.suspension_reversible_hint_html', date: content_tag(:strong, l(@deletion_request.due_at.to_date))) : t('admin.accounts.suspension_irreversible')
  179. = link_to t('admin.accounts.undo_suspension'), unsuspend_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsuspend, @account)
  180. = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account) && @account.suspension_origin_remote?
  181. - if @deletion_request.present?
  182. = link_to t('admin.accounts.delete'), admin_account_path(@account.id), method: :delete, class: 'button button--destructive', data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, @account)
  183. - else
  184. %div.action-buttons
  185. %div
  186. - if @account.local? && @account.user_approved?
  187. = link_to t('admin.accounts.warn'), new_admin_account_action_path(@account.id, type: 'none'), class: 'button' if can?(:warn, @account)
  188. - if @account.user_disabled?
  189. = link_to t('admin.accounts.enable'), enable_admin_account_path(@account.id), method: :post, class: 'button' if can?(:enable, @account.user)
  190. - else
  191. = link_to t('admin.accounts.disable'), new_admin_account_action_path(@account.id, type: 'disable'), class: 'button' if can?(:disable, @account.user)
  192. - if @account.sensitized?
  193. = link_to t('admin.accounts.undo_sensitized'), unsensitive_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsensitive, @account)
  194. - elsif !@account.local? || @account.user_approved?
  195. = link_to t('admin.accounts.sensitive'), new_admin_account_action_path(@account.id, type: 'sensitive'), class: 'button' if can?(:sensitive, @account)
  196. - if @account.silenced?
  197. = link_to t('admin.accounts.undo_silenced'), unsilence_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsilence, @account)
  198. - elsif !@account.local? || @account.user_approved?
  199. = link_to t('admin.accounts.silence'), new_admin_account_action_path(@account.id, type: 'silence'), class: 'button' if can?(:silence, @account)
  200. - if @account.local?
  201. - if @account.user_pending?
  202. = link_to t('admin.accounts.approve'), approve_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button' if can?(:approve, @account.user)
  203. = link_to t('admin.accounts.reject'), reject_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button button--destructive' if can?(:reject, @account.user)
  204. - unless @account.user_confirmed?
  205. = link_to t('admin.accounts.confirm'), admin_account_confirmation_path(@account.id), method: :post, class: 'button' if can?(:confirm, @account.user)
  206. - if !@account.local? || @account.user_approved?
  207. = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@account.id, type: 'suspend'), class: 'button' if can?(:suspend, @account)
  208. %div
  209. - if @account.local?
  210. - if !@account.memorial? && @account.user_approved?
  211. = link_to t('admin.accounts.memorialize'), memorialize_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button button--destructive' if can?(:memorialize, @account)
  212. - else
  213. = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account)
  214. %hr.spacer/
  215. - unless @warnings.empty?
  216. %h3= t 'admin.accounts.previous_strikes'
  217. %p= t('admin.accounts.previous_strikes_description_html', count: @account.previous_strikes_count)
  218. .account-strikes
  219. = render @warnings
  220. %hr.spacer/
  221. %h3= t 'admin.reports.notes.title'
  222. %p= t 'admin.reports.notes_description_html'
  223. .report-notes
  224. = render partial: 'admin/report_notes/report_note', collection: @moderation_notes
  225. = simple_form_for @account_moderation_note, url: admin_account_moderation_notes_path do |f|
  226. = f.hidden_field :target_account_id
  227. .field-group
  228. = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6
  229. .actions
  230. = f.button :button, t('admin.account_moderation_notes.create'), type: :submit
  231. %hr.spacer/
  232. - if @account.user&.invite_request&.text&.present?
  233. %div.speech-bubble
  234. %div.speech-bubble__bubble
  235. = @account.user&.invite_request&.text
  236. %div.speech-bubble__owner
  237. = admin_account_link_to @account
  238. = t('admin.accounts.invite_request_text')