You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
12 KiB

  1. - content_for :page_title do
  2. = @account.acct
  3. = render 'application/card', account: @account
  4. - account = @account
  5. - proofs = account.identity_proofs.active
  6. - fields = account.fields
  7. - unless fields.empty? && proofs.empty? && account.note.blank?
  8. .admin-account-bio
  9. - unless fields.empty? && proofs.empty?
  10. %div
  11. .account__header__fields
  12. - proofs.each do |proof|
  13. %dl
  14. %dt= proof.provider.capitalize
  15. %dd.verified
  16. = link_to fa_icon('check'), proof.badge.proof_url, class: 'verified__mark', title: t('accounts.link_verified_on', date: l(proof.updated_at))
  17. = link_to proof.provider_username, proof.badge.profile_url
  18. - fields.each do |field|
  19. %dl
  20. %dt.emojify{ title: field.name }= Formatter.instance.format_field(account, field.name, custom_emojify: true)
  21. %dd{ title: field.value, class: custom_field_classes(field) }
  22. - if field.verified?
  23. %span.verified__mark{ title: t('accounts.link_verified_on', date: l(field.verified_at)) }
  24. = fa_icon 'check'
  25. = Formatter.instance.format_field(account, field.value, custom_emojify: true)
  26. - if account.note.present?
  27. %div
  28. .account__header__content.emojify= Formatter.instance.simplified_format(account, custom_emojify: true)
  29. .dashboard__counters.admin-account-counters
  30. %div
  31. = link_to admin_account_statuses_path(@account.id) do
  32. .dashboard__counters__num= number_with_delimiter @account.statuses_count
  33. .dashboard__counters__label= t 'admin.accounts.statuses'
  34. %div
  35. = link_to admin_account_statuses_path(@account.id, { media: true }) do
  36. .dashboard__counters__num= number_to_human_size @account.media_attachments.sum('file_file_size')
  37. .dashboard__counters__label= t 'admin.accounts.media_attachments'
  38. %div
  39. = link_to admin_account_relationships_path(@account.id, location: 'local', relationship: 'followed_by') do
  40. .dashboard__counters__num= number_with_delimiter @account.local_followers_count
  41. .dashboard__counters__label= t 'admin.accounts.followers'
  42. %div
  43. = link_to admin_reports_path(account_id: @account.id) do
  44. .dashboard__counters__num= number_with_delimiter @account.reports.count
  45. .dashboard__counters__label= t '.created_reports'
  46. %div
  47. = link_to admin_reports_path(target_account_id: @account.id) do
  48. .dashboard__counters__num= number_with_delimiter @account.targeted_reports.count
  49. .dashboard__counters__label= t '.targeted_reports'
  50. %div
  51. = link_to admin_action_logs_path(target_account_id: @account.id) do
  52. .dashboard__counters__text
  53. - if @account.local? && @account.user.nil?
  54. = t('admin.accounts.deleted')
  55. - elsif @account.memorial?
  56. = t('admin.accounts.memorialized')
  57. - elsif @account.suspended?
  58. = t('admin.accounts.suspended')
  59. - elsif @account.silenced?
  60. = t('admin.accounts.silenced')
  61. - elsif @account.local? && @account.user&.disabled?
  62. = t('admin.accounts.disabled')
  63. - elsif @account.local? && !@account.user&.confirmed?
  64. = t('admin.accounts.confirming')
  65. - elsif @account.local? && !@account.user_approved?
  66. = t('admin.accounts.pending')
  67. - else
  68. = t('admin.accounts.no_limits_imposed')
  69. .dashboard__counters__label= t 'admin.accounts.login_status'
  70. - unless @account.local? && @account.user.nil?
  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= t('simple_form.labels.defaults.locale')
  115. %td= @account.user_locale
  116. %td
  117. %tr
  118. %th= t('admin.accounts.joined')
  119. %td
  120. %time.formatted{ datetime: @account.created_at.iso8601, title: l(@account.created_at) }= l @account.created_at
  121. %td
  122. - @account.user.recent_ips.each_with_index do |(_, ip), i|
  123. %tr
  124. - if i.zero?
  125. %th{ rowspan: @account.user.recent_ips.size }= t('admin.accounts.most_recent_ip')
  126. %td= ip
  127. %td= table_link_to 'search', t('admin.accounts.search_same_ip'), admin_accounts_path(ip: ip)
  128. %tr
  129. %th= t('admin.accounts.most_recent_activity')
  130. %td
  131. - if @account.user_current_sign_in_at
  132. %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
  133. %td
  134. - if @account.user&.invited?
  135. %tr
  136. %th= t('admin.accounts.invited_by')
  137. %td= admin_account_link_to @account.user.invite.user.account
  138. %td
  139. - else
  140. %tr
  141. %th= t('admin.accounts.inbox_url')
  142. %td
  143. = @account.inbox_url
  144. = fa_icon DeliveryFailureTracker.available?(@account.inbox_url) ? 'check' : 'times'
  145. %td
  146. = table_link_to 'search', @domain_block.present? ? t('admin.domain_blocks.view') : t('admin.accounts.view_domain'), admin_instance_path(@account.domain)
  147. %tr
  148. %th= t('admin.accounts.shared_inbox_url')
  149. %td
  150. = @account.shared_inbox_url
  151. = fa_icon DeliveryFailureTracker.available?(@account.shared_inbox_url) ? 'check': 'times'
  152. %td
  153. - if @domain_block.nil?
  154. = table_link_to 'ban', t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @account.domain)
  155. - if @account.suspended?
  156. %hr.spacer/
  157. %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')
  158. = link_to t('admin.accounts.undo_suspension'), unsuspend_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsuspend, @account)
  159. - if @deletion_request.present?
  160. = 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)
  161. - else
  162. %div.action-buttons
  163. %div
  164. - if @account.local? && @account.user_approved?
  165. = link_to t('admin.accounts.warn'), new_admin_account_action_path(@account.id, type: 'none'), class: 'button' if can?(:warn, @account)
  166. - if @account.user_disabled?
  167. = link_to t('admin.accounts.enable'), enable_admin_account_path(@account.id), method: :post, class: 'button' if can?(:enable, @account.user)
  168. - else
  169. = link_to t('admin.accounts.disable'), new_admin_account_action_path(@account.id, type: 'disable'), class: 'button' if can?(:disable, @account.user)
  170. - if @account.silenced?
  171. = link_to t('admin.accounts.undo_silenced'), unsilence_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsilence, @account)
  172. - elsif !@account.local? || @account.user_approved?
  173. = link_to t('admin.accounts.silence'), new_admin_account_action_path(@account.id, type: 'silence'), class: 'button' if can?(:silence, @account)
  174. - if @account.local?
  175. - if @account.user_pending?
  176. = 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)
  177. = 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)
  178. - unless @account.user_confirmed?
  179. = link_to t('admin.accounts.confirm'), admin_account_confirmation_path(@account.id), method: :post, class: 'button' if can?(:confirm, @account.user)
  180. - if !@account.local? || @account.user_approved?
  181. = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@account.id, type: 'suspend'), class: 'button' if can?(:suspend, @account)
  182. %div
  183. - if @account.local?
  184. = link_to t('admin.accounts.reset_password'), admin_account_reset_path(@account.id), method: :create, class: 'button' if can?(:reset_password, @account.user)
  185. - if @account.user&.otp_required_for_login?
  186. = link_to t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(@account.user.id), method: :delete, class: 'button' if can?(:disable_2fa, @account.user)
  187. - if !@account.memorial? && @account.user_approved?
  188. = 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)
  189. - else
  190. = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account)
  191. %hr.spacer/
  192. - unless @warnings.empty?
  193. = render @warnings
  194. %hr.spacer/
  195. = render @moderation_notes
  196. = simple_form_for @account_moderation_note, url: admin_account_moderation_notes_path do |f|
  197. = render 'shared/error_messages', object: @account_moderation_note
  198. = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6
  199. = f.hidden_field :target_account_id
  200. .actions
  201. = f.button :button, t('admin.account_moderation_notes.create'), type: :submit