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.

235 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{ style: 'margin-top: 10px' }
  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. %span.neutral= t('admin.accounts.deleted')
  55. - elsif @account.suspended?
  56. %span.red= t('admin.accounts.suspended')
  57. - elsif @account.silenced?
  58. %span.red= t('admin.accounts.silenced')
  59. - elsif @account.local? && @account.user&.disabled?
  60. %span.red= t('admin.accounts.disabled')
  61. - elsif @account.local? && !@account.user&.confirmed?
  62. %span.neutral= t('admin.accounts.confirming')
  63. - elsif @account.local? && !@account.user_approved?
  64. %span.neutral= t('admin.accounts.pending')
  65. - else
  66. %span.neutral= t('admin.accounts.no_limits_imposed')
  67. .dashboard__counters__label= t 'admin.accounts.login_status'
  68. - unless @account.local? && @account.user.nil?
  69. .table-wrapper
  70. %table.table.inline-table
  71. %tbody
  72. - if @account.local?
  73. - if @account.avatar?
  74. %tr
  75. %th= t('admin.accounts.avatar')
  76. %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)
  77. %td
  78. - if @account.header?
  79. %tr
  80. %th= t('admin.accounts.header')
  81. %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)
  82. %td
  83. %tr
  84. %th= t('admin.accounts.role')
  85. %td= t("admin.accounts.roles.#{@account.user&.role}")
  86. %td
  87. = 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)
  88. = 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)
  89. %tr
  90. %th{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= t('admin.accounts.email')
  91. %td{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= @account.user_email
  92. %td= table_link_to 'edit', t('admin.accounts.change_email.label'), admin_account_change_email_path(@account.id) if can?(:change_email, @account.user)
  93. %tr
  94. %td= table_link_to 'search', t('admin.accounts.search_same_email_domain'), admin_accounts_path(email: "%@#{@account.user_email.split('@').last}")
  95. - if can?(:create, :email_domain_block)
  96. %tr
  97. %td= table_link_to 'ban', t('admin.accounts.add_email_domain_block'), new_admin_email_domain_block_path(_domain: @account.user_email.split('@').last)
  98. - if @account.user_unconfirmed_email.present?
  99. %tr
  100. %th= t('admin.accounts.unconfirmed_email')
  101. %td= @account.user_unconfirmed_email
  102. %td
  103. %tr
  104. %th= t('admin.accounts.email_status')
  105. %td
  106. - if @account.user&.confirmed?
  107. = t('admin.accounts.confirmed')
  108. - else
  109. = t('admin.accounts.confirming')
  110. %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)
  111. %tr
  112. %th= t('admin.accounts.login_status')
  113. %td
  114. - if @account.user&.disabled?
  115. = t('admin.accounts.disabled')
  116. - else
  117. = t('admin.accounts.enabled')
  118. %td
  119. - if @account.user&.disabled?
  120. = table_link_to 'unlock', t('admin.accounts.enable'), enable_admin_account_path(@account.id), method: :post if can?(:enable, @account.user)
  121. - elsif @account.user_approved?
  122. = table_link_to 'lock', t('admin.accounts.disable'), new_admin_account_action_path(@account.id, type: 'disable') if can?(:disable, @account.user)
  123. %tr
  124. %th= t('simple_form.labels.defaults.locale')
  125. %td= @account.user_locale
  126. %td
  127. %tr
  128. %th= t('admin.accounts.joined')
  129. %td
  130. %time.formatted{ datetime: @account.created_at.iso8601, title: l(@account.created_at) }= l @account.created_at
  131. %td
  132. - @account.user.recent_ips.each_with_index do |(_, ip), i|
  133. %tr
  134. - if i.zero?
  135. %th{ rowspan: @account.user.recent_ips.size }= t('admin.accounts.most_recent_ip')
  136. %td= ip
  137. %td= table_link_to 'search', t('admin.accounts.search_same_ip'), admin_accounts_path(ip: ip)
  138. %tr
  139. %th= t('admin.accounts.most_recent_activity')
  140. %td
  141. - if @account.user_current_sign_in_at
  142. %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
  143. %td
  144. - if @account.user&.invited?
  145. %tr
  146. %th= t('admin.accounts.invited_by')
  147. %td= admin_account_link_to @account.user.invite.user.account
  148. %td
  149. - else
  150. %tr
  151. %th= t('admin.accounts.inbox_url')
  152. %td
  153. = @account.inbox_url
  154. = fa_icon DeliveryFailureTracker.unavailable?(@account.inbox_url) ? 'times' : 'check'
  155. %tr
  156. %th= t('admin.accounts.shared_inbox_url')
  157. %td
  158. = @account.shared_inbox_url
  159. = fa_icon DeliveryFailureTracker.unavailable?(@account.shared_inbox_url) ? 'times' : 'check'
  160. %div{ style: 'overflow: hidden' }
  161. %div{ style: 'float: right' }
  162. - if @account.local?
  163. = link_to t('admin.accounts.reset_password'), admin_account_reset_path(@account.id), method: :create, class: 'button' if can?(:reset_password, @account.user)
  164. - if @account.user&.otp_required_for_login?
  165. = 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)
  166. - if !@account.memorial? && @account.user_approved?
  167. = 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)
  168. - else
  169. = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account)
  170. %div{ style: 'float: left' }
  171. - if @account.local? && @account.user_approved?
  172. = link_to t('admin.accounts.warn'), new_admin_account_action_path(@account.id, type: 'none'), class: 'button' if can?(:warn, @account)
  173. - if @account.silenced?
  174. = link_to t('admin.accounts.undo_silenced'), unsilence_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsilence, @account)
  175. - elsif !@account.local? || @account.user_approved?
  176. = link_to t('admin.accounts.silence'), new_admin_account_action_path(@account.id, type: 'silence'), class: 'button button--destructive' if can?(:silence, @account)
  177. - if @account.local?
  178. - if @account.user_pending?
  179. = 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)
  180. = 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)
  181. - unless @account.user_confirmed?
  182. = link_to t('admin.accounts.confirm'), admin_account_confirmation_path(@account.id), method: :post, class: 'button' if can?(:confirm, @account.user)
  183. - if @account.suspended?
  184. = link_to t('admin.accounts.undo_suspension'), unsuspend_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsuspend, @account)
  185. - elsif !@account.local? || @account.user_approved?
  186. = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@account.id, type: 'suspend'), class: 'button button--destructive' if can?(:suspend, @account)
  187. - unless @account.local?
  188. - if DomainBlock.rule_for(@account.domain)
  189. = link_to t('admin.domain_blocks.view'), admin_instance_path(@account.domain), class: 'button'
  190. - else
  191. = link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @account.domain), class: 'button button--destructive'
  192. %hr.spacer/
  193. - unless @warnings.empty?
  194. = render @warnings
  195. %hr.spacer/
  196. = render @moderation_notes
  197. = simple_form_for @account_moderation_note, url: admin_account_moderation_notes_path do |f|
  198. = render 'shared/error_messages', object: @account_moderation_note
  199. = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6
  200. = f.hidden_field :target_account_id
  201. .actions
  202. = f.button :button, t('admin.account_moderation_notes.create'), type: :submit