show.html.haml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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= t("admin.accounts.roles.#{@account.user&.role}")
  88. %td
  89. = table_link_to 'angle-double-up', t('admin.accounts.promote'), promote_admin_account_role_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:promote, @account.user)
  90. = table_link_to 'angle-double-down', t('admin.accounts.demote'), demote_admin_account_role_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:demote, @account.user)
  91. %tr
  92. %th{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= t('admin.accounts.email')
  93. %td{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= @account.user_email
  94. %td= table_link_to 'edit', t('admin.accounts.change_email.label'), admin_account_change_email_path(@account.id) if can?(:change_email, @account.user)
  95. %tr
  96. %td= table_link_to 'search', t('admin.accounts.search_same_email_domain'), admin_accounts_path(email: "%@#{@account.user_email.split('@').last}")
  97. - if can?(:create, :email_domain_block)
  98. %tr
  99. %td= table_link_to 'ban', t('admin.accounts.add_email_domain_block'), new_admin_email_domain_block_path(_domain: @account.user_email.split('@').last)
  100. - if @account.user_unconfirmed_email.present?
  101. %tr
  102. %th= t('admin.accounts.unconfirmed_email')
  103. %td= @account.user_unconfirmed_email
  104. %td
  105. %tr
  106. %th= t('admin.accounts.email_status')
  107. %td
  108. - if @account.user&.confirmed?
  109. = t('admin.accounts.confirmed')
  110. - else
  111. = t('admin.accounts.confirming')
  112. %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)
  113. %tr
  114. %th{ rowspan: can?(:reset_password, @account.user) ? 2 : 1 }= t('admin.accounts.security')
  115. %td{ rowspan: can?(:reset_password, @account.user) ? 2 : 1 }
  116. - if @account.user&.two_factor_enabled?
  117. = t 'admin.accounts.security_measures.password_and_2fa'
  118. - else
  119. = t 'admin.accounts.security_measures.only_password'
  120. %td
  121. - if @account.user&.two_factor_enabled?
  122. = 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)
  123. - if can?(:reset_password, @account.user)
  124. %tr
  125. %td
  126. = 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') }
  127. %tr
  128. %th= t('simple_form.labels.defaults.locale')
  129. %td= standard_locale_name(@account.user_locale)
  130. %td
  131. %tr
  132. %th= t('admin.accounts.joined')
  133. %td
  134. %time.formatted{ datetime: @account.created_at.iso8601, title: l(@account.created_at) }= l @account.created_at
  135. %td
  136. - recent_ips = @account.user.ips.order(used_at: :desc).to_a
  137. - recent_ips.each_with_index do |recent_ip, i|
  138. %tr
  139. - if i.zero?
  140. %th{ rowspan: recent_ips.size }= t('admin.accounts.most_recent_ip')
  141. %td= recent_ip.ip
  142. %td= table_link_to 'search', t('admin.accounts.search_same_ip'), admin_accounts_path(ip: recent_ip.ip)
  143. %tr
  144. %th= t('admin.accounts.most_recent_activity')
  145. %td
  146. - if @account.user_current_sign_in_at
  147. %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
  148. %td
  149. - if @account.user&.invited?
  150. %tr
  151. %th= t('admin.accounts.invited_by')
  152. %td= admin_account_link_to @account.user.invite.user.account
  153. %td
  154. - else
  155. %tr
  156. %th= t('admin.accounts.inbox_url')
  157. %td
  158. = @account.inbox_url
  159. = fa_icon DeliveryFailureTracker.available?(@account.inbox_url) ? 'check' : 'times'
  160. %td
  161. = table_link_to 'search', @domain_block.present? ? t('admin.domain_blocks.view') : t('admin.accounts.view_domain'), admin_instance_path(@account.domain)
  162. %tr
  163. %th= t('admin.accounts.shared_inbox_url')
  164. %td
  165. = @account.shared_inbox_url
  166. = fa_icon DeliveryFailureTracker.available?(@account.shared_inbox_url) ? 'check': 'times'
  167. %td
  168. - if @domain_block.nil?
  169. = table_link_to 'ban', t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @account.domain)
  170. - if @account.suspended?
  171. %hr.spacer/
  172. %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')
  173. = link_to t('admin.accounts.undo_suspension'), unsuspend_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsuspend, @account)
  174. - if @deletion_request.present?
  175. = 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)
  176. - else
  177. %div.action-buttons
  178. %div
  179. - if @account.local? && @account.user_approved?
  180. = link_to t('admin.accounts.warn'), new_admin_account_action_path(@account.id, type: 'none'), class: 'button' if can?(:warn, @account)
  181. - if @account.user_disabled?
  182. = link_to t('admin.accounts.enable'), enable_admin_account_path(@account.id), method: :post, class: 'button' if can?(:enable, @account.user)
  183. - else
  184. = link_to t('admin.accounts.disable'), new_admin_account_action_path(@account.id, type: 'disable'), class: 'button' if can?(:disable, @account.user)
  185. - if @account.sensitized?
  186. = link_to t('admin.accounts.undo_sensitized'), unsensitive_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsensitive, @account)
  187. - elsif !@account.local? || @account.user_approved?
  188. = link_to t('admin.accounts.sensitive'), new_admin_account_action_path(@account.id, type: 'sensitive'), class: 'button' if can?(:sensitive, @account)
  189. - if @account.silenced?
  190. = link_to t('admin.accounts.undo_silenced'), unsilence_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsilence, @account)
  191. - elsif !@account.local? || @account.user_approved?
  192. = link_to t('admin.accounts.silence'), new_admin_account_action_path(@account.id, type: 'silence'), class: 'button' if can?(:silence, @account)
  193. - if @account.local?
  194. - if @account.user_pending?
  195. = 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)
  196. = 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)
  197. - unless @account.user_confirmed?
  198. = link_to t('admin.accounts.confirm'), admin_account_confirmation_path(@account.id), method: :post, class: 'button' if can?(:confirm, @account.user)
  199. - if !@account.local? || @account.user_approved?
  200. = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@account.id, type: 'suspend'), class: 'button' if can?(:suspend, @account)
  201. %div
  202. - if @account.local?
  203. - if !@account.memorial? && @account.user_approved?
  204. = 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)
  205. - else
  206. = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account)
  207. %hr.spacer/
  208. - unless @warnings.empty?
  209. %h3= t 'admin.accounts.previous_strikes'
  210. %p= t('admin.accounts.previous_strikes_description_html', count: @account.previous_strikes_count)
  211. .account-strikes
  212. = render @warnings
  213. %hr.spacer/
  214. %h3= t 'admin.reports.notes.title'
  215. %p= t 'admin.reports.notes_description_html'
  216. .report-notes
  217. = render partial: 'admin/report_notes/report_note', collection: @moderation_notes
  218. = simple_form_for @account_moderation_note, url: admin_account_moderation_notes_path do |f|
  219. = f.hidden_field :target_account_id
  220. .field-group
  221. = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6
  222. .actions
  223. = f.button :button, t('admin.account_moderation_notes.create'), type: :submit
  224. %hr.spacer/
  225. - if @account.user&.invite_request&.text&.present?
  226. %div.speech-bubble
  227. %div.speech-bubble__bubble
  228. = @account.user&.invite_request&.text
  229. %div.speech-bubble__owner
  230. = admin_account_link_to @account
  231. = t('admin.accounts.invite_request_text')