From c91bdeaeb2b6afdfef12a8ff3fe06c3bfd93ec56 Mon Sep 17 00:00:00 2001 From: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Date: Tue, 15 Mar 2022 06:53:21 -0600 Subject: [PATCH] Removes views that have been replaced with the Admin Member Detailed view (#16852) --- app/views/admin/users/_activity.html.erb | 13 -- app/views/admin/users/_credits.html.erb | 47 ----- app/views/admin/users/_current_roles.html.erb | 19 -- app/views/admin/users/_data_export.html.erb | 23 --- .../admin/users/_negative_reactions.html.erb | 19 -- app/views/admin/users/_notes.html.erb | 26 --- app/views/admin/users/_reports.html.erb | 19 -- .../admin/users/_user_organizations.html.erb | 52 ------ app/views/admin/users/edit.html.erb | 165 ------------------ 9 files changed, 383 deletions(-) delete mode 100644 app/views/admin/users/_activity.html.erb delete mode 100644 app/views/admin/users/_credits.html.erb delete mode 100644 app/views/admin/users/_current_roles.html.erb delete mode 100644 app/views/admin/users/_data_export.html.erb delete mode 100644 app/views/admin/users/_negative_reactions.html.erb delete mode 100644 app/views/admin/users/_notes.html.erb delete mode 100644 app/views/admin/users/_reports.html.erb delete mode 100644 app/views/admin/users/_user_organizations.html.erb delete mode 100644 app/views/admin/users/edit.html.erb diff --git a/app/views/admin/users/_activity.html.erb b/app/views/admin/users/_activity.html.erb deleted file mode 100644 index bb4061e0c..000000000 --- a/app/views/admin/users/_activity.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
-
-

Activity

- -
-
diff --git a/app/views/admin/users/_credits.html.erb b/app/views/admin/users/_credits.html.erb deleted file mode 100644 index 09e2e01f1..000000000 --- a/app/views/admin/users/_credits.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -
-

Credits

- -
-

<%= @user.username %>

- <% current_credits = @user.unspent_credits_count %> -

Available User Credits: <%= current_credits %>

- <%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> -
- <%= f.number_field :add_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %> - <%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control" %> -
- <%= f.submit "Add Credits", class: "btn btn-primary" %> - <% end %> - <% if current_credits.positive? %> - <%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> -
- <%= f.number_field :remove_credits, in: 1..current_credits, required: true, class: "form-control mr-3", size: 5 %> - <%= f.text_field :new_note, placeholder: "Why are you removing these credits?", size: 50, required: true, class: "form-control" %> -
- <%= f.submit "Remove Credits", class: "btn btn-danger" %> - <% end %> - <% end %> -
- - <% if @organizations.present? %> -
-

Organizations

- <%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> -
- <%= f.number_field :add_org_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %> - <%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control mr-3" %> - <%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: "form-control" } %> -
- <%= f.submit "Add Org Credits", class: "btn btn-primary" %> - <% end %> - <%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> -
- <%= f.number_field :remove_org_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %> - <%= f.text_field :new_note, placeholder: "Why are you removing these credits?", size: 50, required: true, class: "form-control mr-3" %> - <%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: "form-control" } %> -
- <%= f.submit "Remove Org Credits", class: "btn btn-danger" %> - <% end %> -
- <% end %> -
diff --git a/app/views/admin/users/_current_roles.html.erb b/app/views/admin/users/_current_roles.html.erb deleted file mode 100644 index 969b93f26..000000000 --- a/app/views/admin/users/_current_roles.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -
-

Current Roles

-

(View full history in notes below)

-
- -
-
diff --git a/app/views/admin/users/_data_export.html.erb b/app/views/admin/users/_data_export.html.erb deleted file mode 100644 index 9699d16c8..000000000 --- a/app/views/admin/users/_data_export.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -
-
-

Data Export

- -
-
-

- You can export a user's data here. Currently we only support exporting a user's posts and comments. -

-

- You have the option of exporting to your admin account to send to the user, or exporting to the user directly. -

-

- Exporting the data to your admin account will send it to your contact - admin email (<%= ForemInstance.contact_email %>), - and exporting to the user will send it to their email (<%= @user.email %>). -

-
- <%= button_to "Export to Admin", export_data_admin_user_path(@user.id), data: { confirm: "Are you sure you want to export this user's content to the ADMIN?" }, class: "crayons-btn", params: { send_to_admin: true }, style: "margin-right: 8px;" %> - <%= button_to "Export to User", export_data_admin_user_path(@user.id), data: { confirm: "Are you sure you want to export this user's content to the USER?" }, class: "crayons-btn", params: { send_to_admin: false } %> -
-
-
diff --git a/app/views/admin/users/_negative_reactions.html.erb b/app/views/admin/users/_negative_reactions.html.erb deleted file mode 100644 index 11ba67180..000000000 --- a/app/views/admin/users/_negative_reactions.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -
-
-

Recent Reactions

- -
-
- <% unless @related_vomit_reactions.empty? %> - <% @related_vomit_reactions.each do |reaction| %> - - <%= crayons_icon_tag("twemoji/suspicious", native: true, class: "mr-1", aria_hidden: true) %><%= t("views.reactions.category.#{reaction.category}") %> - <%= reaction.reactable_type %><%= reaction.reactable_type == "User" ? "" : ": #{reaction.reactable.title}" %> - <%= reaction.created_at&.strftime("%b %e '%y") %> - - <% end %> - <% else %> -

Nothing negative to see here! 👀

- <% end %> -
-
diff --git a/app/views/admin/users/_notes.html.erb b/app/views/admin/users/_notes.html.erb deleted file mode 100644 index 1153af1cd..000000000 --- a/app/views/admin/users/_notes.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
-

Recent Notes (last 10)

- - <% unless @notes.load.empty? %> - <% @notes.each do |note| %> -

- - <%= note.created_at.strftime("%d %B %Y %H:%M UTC") %> by <%= User.find(note.author_id).username if note.author_id.present? %> - - - <% unless note.reason.blank? %> - <%= note.reason %>: - <% end %> - <%= note.content %> -

- <% end %> - <% else %> -
No notes yet...
- <% end %> - <%= form_with model: @user, url: admin_user_path(@user), method: :patch, html: { class: "mb-2" }, local: true do |f| %> -
- <%= f.label "Add new note: ", class: "d-block" %> - <%= f.text_area :new_note, class: "form-control" %> -
- <%= f.submit "Submit Note", class: "crayons-btn float-right" %> - <% end %> -
diff --git a/app/views/admin/users/_reports.html.erb b/app/views/admin/users/_reports.html.erb deleted file mode 100644 index 7ff2f1b94..000000000 --- a/app/views/admin/users/_reports.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -
-
-

Recent Reports

- -
-
- <% unless @related_reports.empty? %> - <% @related_reports.each do |report| %> - - <%= report.category.capitalize %> (<%= report.status %>) - <%= report.user_types(@user.id).to_sentence %>: <%= report.message %> - <%= report.created_at&.strftime("%b %e '%y") %> - - <% end %> - <% else %> -

Nothing to report here! 👀

- <% end %> -
-
diff --git a/app/views/admin/users/_user_organizations.html.erb b/app/views/admin/users/_user_organizations.html.erb deleted file mode 100644 index de438c65d..000000000 --- a/app/views/admin/users/_user_organizations.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -
-

Organization Memberships

- -
-

Add to New Organization

- <%= form_with model: [:admin, OrganizationMembership.new], local: true, html: { class: "form-inline justify-content-between my-3" } do |f| %> - <%= f.hidden_field :user_id, value: @user.id %> -
- <%= f.label "Organization ID:", class: "mr-3" %> - <%= f.text_field :organization_id, class: "form-control mr-3", size: 8 %> - <%= f.label "Membership Level:", class: "mr-3" %> - <%= f.select(:type_of_user, options_for_select(%w[member admin])) %> -
-
- <%= f.submit "Add to Org", class: "btn btn-primary" %> -
- <% end %> -
- - <% unless @organization_memberships.load.empty? %> -
-

Manage Memberships

- - - <% @organization_memberships.each do |org_membership| %> - - - - - - <% end %> - -
- -

<%= org_membership.organization.name %>

-
-
- <%= form_with model: [:admin, org_membership], method: :patch, local: true, html: { class: "form-inline justify-content-between" } do |f| %> -
- <%= f.label "Permission Level:", class: "mr-3" %> - <%= f.select("type_of_user", options_for_select(%w[member admin], selected: org_membership.type_of_user)) %> -
- <%= f.submit "Update Permissions", class: "btn btn-primary " %> - <% end %> -
- <%= form_with model: [:admin, org_membership], method: :delete, local: true, html: { class: "d-flex justify-content-end" } do |f| %> - <%= f.submit "Remove From Org", class: "btn btn-danger", data: { confirm: "Are you sure you want to remove them from #{org_membership.organization.name}?" } %> - <% end %> -
-
- <% end %> -
diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb deleted file mode 100644 index 9b7f81c3c..000000000 --- a/app/views/admin/users/edit.html.erb +++ /dev/null @@ -1,165 +0,0 @@ -
-
-

- <%= @user.name %><%= link_to "@#{@user.username}", @user.path, class: "ml-2", target: "_blank", rel: "noopener" %> -

- - <% if @user.access_locked? %> -
- <%= link_to "Unlock access", unlock_access_admin_user_path(@user), method: :patch, class: "btn btn-success" %> -
- <% end %> - Admin Profile -

Member since <%= @user.created_at.strftime("%b %e '%y") %>

-
- - <%= render "activity" %> - <%= render "current_roles" %> - -
-
-

- User Status - <% if @user.suspended? %> - 🚨 Member is Suspended 🚨 - <% elsif @user.warned? %> - Member is Warned - <% elsif @user.comment_suspended? %> - Member is Comment Suspended - <% elsif @user.trusted? %> - Member is Trusted - <% else %> - Member is in Good Standing - <% end %> -

-
- <%= form_for(@user, url: user_status_admin_user_path(@user), html: { class: "mt-3" }) do |f| %> -
- <%= 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.super_admin? %> - <%= f.select(:user_status, grouped_options_for_select(options), include_blank: true) %> -
-
- <%= f.label "Reason for action:" %> - <%= f.text_area :note_for_current_role, required: true, class: "form-control" %> -
- <%= f.submit "Update User Status", class: "crayons-btn float-right" %> - <% end %> -
- -<%= render "notes" %> -<%= render "negative_reactions" %> -<%= render "reports" %> -<%= render "data_export" %> - -
-
-

Remove Identity

- -
-
-

Removing a social account identity can solve certain sign in issues, for example:

-
    -
  • - 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: - - Steps to check: -
      -
    1. Click one of the links to check their social account's UID.
    2. -
    3. Confirm whether or not it matches with the identity's UID.
    4. -
    5. If it doesn't match, delete the respective identity.
    6. -
    7. Ask the user to reauthorize their social account via <%= app_url(user_settings_path(:account)) %>
    8. -
    -
  • - <% @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 %> -

    <%= identity.provider.capitalize %> UID: <%= identity.uid %> - Username: <%= identity.auth_data_dump.present? ? identity.auth_data_dump["info"]["nickname"] : "no auth data dump available! 😞" %>

    - <%= f.submit "Delete #{identity.provider.capitalize} Identity", class: "btn btn-danger" %> - <% end %> - <% end %> -
-
-
- -
-
-

Semi-Destructive Actions

- -
-
-

Unpublish all posts

-

This will make all links of the user's posts unreachable. If the user is not suspended, they can still re-publish their posts.

- <%= form_for(@user, url: unpublish_all_articles_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? All posts will be unavailable to the community.')" }) do |f| %> - - <% end %> -
-
- -
-
-

Destructive Actions

- -
- -
-
-

Merge User

-

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.

- <%= 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 %> -
- -
-

Banish User

- <% if @user.comments.where("created_at < ?", 100.days.ago).empty? && @user.created_at < 100.days.ago %> -

- This is extremely destructive. Banishing will delete all the user's existing content and change their username to @spam_###. -

-

Do not do this lightly.

- <%= 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 %> - - <% end %> - <% elsif current_user.super_admin? || current_user.support_admin? %> -

This is not a new user. You are only allowed to take this action because you are a - super admin or a support admin.

-

- This is extremely destructive. Banishing will delete all the user's existing content and change their username to @spam_###. -

-

Do not do this lightly.

- <%= 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 %> - - <% end %> - <% else %> -

This is not a new user. Only super admins or support admins are allowed to banish this user.

- <% end %> -
- - <% if current_user.super_admin? %> -
-

Fully Delete User

-

This will - completely destroy the user and all of their activity from our database. This action is irreversible. -

-

Do not do this lightly.

- <%= 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| %> - - <% end %> -
- <% end %> -
-
- -