* Update data exporter to handle admin send * Match button with everything else * Use proper redirect path * Stub SiteConfig definition instead of setting it Co-authored-by: Mac Siri <krairit.siri@gmail.com> * Removed if statement by accident oops * Remove non-functional boolean param and pass email directly * Use refinement to conv to boolean instead of JSON.parse * Rename to StringToBoolean * Use 'using' in proper scope (not in method) * Rename to_bool to to_boolean * Refactor if statement, thanks rhymes! * Fix small bugs in tests * Remove tracking for export_email b/c no @user Co-authored-by: Mac Siri <krairit.siri@gmail.com>
150 lines
7.8 KiB
Text
150 lines
7.8 KiB
Text
<div class="grid gap-6">
|
|
<div class="crayons-card p-6">
|
|
<h2>
|
|
<%= @user.name %><%= link_to "@#{@user.username}", @user.path, class: "ml-2", target: "_blank", rel: "noopener" %>
|
|
</h2>
|
|
|
|
<% if @user.access_locked? %>
|
|
<div>
|
|
<%= link_to "Unlock access", unlock_access_admin_user_path(@user), method: :patch, class: "btn btn-success" %>
|
|
</div>
|
|
<% end %>
|
|
<a href="<%= admin_user_path(@user) %>" class="crayons-btn float-right">Admin Profile</a>
|
|
<p class="font-italic">Member since <%= @user.created_at.strftime("%b %e '%y") %></p>
|
|
</div>
|
|
|
|
<%= render "activity" %>
|
|
|
|
<div class="crayons-card p-6">
|
|
<div>
|
|
<h2>
|
|
User Status
|
|
<% if @user.banned %>
|
|
<span class="badge badge-danger">🚨 Member is Suspended 🚨</span>
|
|
<% elsif @user.warned %>
|
|
<span class="badge badge-warning">Member is Warned</span>
|
|
<% elsif @user.comment_banned %>
|
|
<span class="badge badge-warning">Member is Comment Banned</span>
|
|
<% elsif @user.trusted %>
|
|
<span class="badge badge-success">Member is Trusted</span>
|
|
<% else %>
|
|
<span class="badge badge-info">Member is in Good Standing</span>
|
|
<% end %>
|
|
</h2>
|
|
</div>
|
|
<%= form_for(@user, url: user_status_admin_user_path(@user), html: { class: "mt-3" }) do |f| %>
|
|
<div class="form-group">
|
|
<%= f.label "Select new user status", class: "mr-3" %>
|
|
<% options = { "Base Roles" => Constants::Role::BASE_ROLES } %>
|
|
<% options["Special Roles"] = Constants::Role::SPECIAL_ROLES if current_user.has_role?(:super_admin) %>
|
|
<%= f.select(:user_status, grouped_options_for_select(options), include_blank: true) %>
|
|
</div>
|
|
<div class="form-group">
|
|
<%= f.label "Reason for action:" %>
|
|
<%= f.text_area :note_for_current_role, required: true, class: "form-control" %>
|
|
</div>
|
|
<%= f.submit "Update User Status", class: "crayons-btn float-right" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= render "notes" %>
|
|
<%= render "negative_reactions" %>
|
|
<%= render "reports" %>
|
|
<%= render "data_export" %>
|
|
|
|
<div class="crayons-card p-6">
|
|
<div>
|
|
<h2 class="d-inline">Remove Identity</h2>
|
|
<button type="button" data-toggle="collapse" data-target="#identity-row" class="crayons-btn float-right">Toggle</button>
|
|
</div>
|
|
<div class="pt-6 collapse" id="identity-row">
|
|
<p>Removing a social account identity can solve certain sign in issues, for example:</p>
|
|
<ul>
|
|
<li>
|
|
They created an account on <%= community_name %>, but deleted their original social account and recreated it with the same Twitter/GitHub username.
|
|
This will be true if their Twitter/GitHub account's UID does not match their identity's UID. You can use the following third party tools to check:
|
|
<ul>
|
|
<li>
|
|
<a href="https://tweeterid.com/?username=<%= @user.twitter_username %>" target="_blank" rel="noopener nofollow">Tweeter ID for Twitter (username is in URL for reference)</a>
|
|
</li>
|
|
<li>
|
|
<a href="https://caius.github.io/github_id/#<%= @user.github_username %>" target="_blank" rel="noopener nofollow">Caius's GitHub ID Lookup Tool</a>
|
|
</li>
|
|
</ul>
|
|
Steps to check:
|
|
<ol>
|
|
<li>Click one of the links to check their social account's UID.</li>
|
|
<li>Confirm whether or not it matches with the identity's UID.</li>
|
|
<li>If it doesn't match, delete the respective identity.</li>
|
|
<li>Ask the user to reauthorize their social account via <%= app_url(user_settings_path(:account)) %></li>
|
|
</ol>
|
|
</li>
|
|
<% @user.identities.each do |identity| %>
|
|
<%= form_for(@user, url: remove_identity_admin_user_path(@user), html: { method: :delete, onsubmit: "return confirm('Are you sure? This should only be done as a solution for the listed example(s).)" }) do |f| %>
|
|
<%= f.hidden_field :identity_id, value: identity.id %>
|
|
<p><b><%= identity.provider.capitalize %> UID: <%= identity.uid %> - Username: <%= identity.auth_data_dump.present? ? identity.auth_data_dump["info"]["nickname"] : "no auth data dump available! 😞" %></b></p>
|
|
<%= f.submit "Delete #{identity.provider.capitalize} Identity", class: "btn btn-danger" %>
|
|
<% end %>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="crayons-card p-6">
|
|
<div>
|
|
<h2 class="d-inline">Destructive Actions</h2>
|
|
<button type="button" data-toggle="collapse" data-target="#destructive-actions" class="crayons-btn float-right">Toggle</button>
|
|
</div>
|
|
|
|
<div id="destructive-actions" class="pt-6 collapse">
|
|
<div class="mb-6">
|
|
<h3>Merge User</h3>
|
|
<p>To merge a duplicate account, make sure you are currently on the page of the user you want to KEEP. Below, add the user id of the account to merge information from, and delete.</p>
|
|
<%= form_for(@user, url: merge_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This is extremely destructive and irreversible. Merging will delete all the other users content and combine it with this user')" }) do |f| %>
|
|
<%= f.label "User to be deleted:" %>
|
|
<%= f.text_field :merge_user_id, placeholder: "#ID" %>
|
|
<%= f.submit "Merge Users", class: "btn btn-danger" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="mb-6">
|
|
<h3>Banish User</h3>
|
|
<% if @user.comments.where("created_at < ?", 100.days.ago).empty? && @user.created_at < 100.days.ago %>
|
|
<p>
|
|
<em>This is extremely destructive. Banishing will delete all the user's existing content and change their username to @spam_###.</em>
|
|
</p>
|
|
<p><strong>Do not do this lightly.</strong></p>
|
|
<%= form_for(@user, url: banish_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This is extremely destructive and irreversible. Banishing will delete all articles and turn their username into @spam_###')" }) do %>
|
|
<button class="btn btn-danger">🚫 Banish User for Spam 🚫</button>
|
|
<% end %>
|
|
<% elsif current_user.has_role?(:super_admin) || current_user.has_role?(:support_admin) %>
|
|
<p><strong>This is not a new user.</strong> You are only allowed to take this action because you are a
|
|
<strong>super admin or a support admin.</strong></p>
|
|
<p>
|
|
<em>This is extremely destructive. Banishing will delete all the user's existing content and change their username to @spam_###.</em>
|
|
</p>
|
|
<p><strong>Do not do this lightly.</strong></p>
|
|
<%= form_for(@user, url: banish_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This is extremely destructive and irreversible. Banishing will delete all articles and turn their username into @spam_###')" }) do %>
|
|
<button class="btn btn-danger">Banish User for Spam!</button>
|
|
<% end %>
|
|
<% else %>
|
|
<p><em>This is not a new user. Only super admins or support admins are allowed to banish this user.</em></p>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if current_user.has_role?(:super_admin) %>
|
|
<div>
|
|
<h3>Fully Delete User</h3>
|
|
<p>This will
|
|
<strong>completely destroy the user</strong> and all of their activity from our database. This action is irreversible.
|
|
</p>
|
|
<p><strong>Do not do this lightly.</strong></p>
|
|
<%= form_for(@user, url: full_delete_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This is extremely destructive and irreversible.')" }) do |f| %>
|
|
<button class="btn btn-danger">☠️ Fully Delete User & All Activity ☠️</button>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|