Update the Copy for all Modals in the Admin Member Detail View (#16708)

* Updates the copy for all modals within Admin Member Detail view

* Resolve most failing tests within managaUserOptions.spec.js

* Update app/views/admin/users/show/profile/actions/_export.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update cypress/integration/seededFlows/adminFlows/users/manageUserOptions.spec.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
This commit is contained in:
Julianna Tetreault 2022-02-28 13:02:57 -07:00 committed by GitHub
parent 2de37815f1
commit 5652a89cd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 53 deletions

View file

@ -28,12 +28,12 @@
</div>
<div class="c-card__revealable shrink-0">
<button type="button" class="c-btn c-btn--icon-alone" aria-label="Edit <%= org_membership.organization.name %> organization membership"
data-modal-trigger data-modal-title="Edit organization" data-modal-size="small" data-modal-content-selector="#edit-organization-<%= org_membership.organization.id %>">
data-modal-trigger data-modal-title="Edit <%= @user.name %>'s role at an organization" data-modal-size="small" data-modal-content-selector="#edit-organization-<%= org_membership.organization.id %>">
<%= crayons_icon_tag(:edit, class: "c-btn__icon", aria_hidden: true) %>
</button>
<%= form_with model: [:admin, org_membership], method: :delete, local: true, html: { class: "inline" } do |f| %>
<%= f.button crayons_icon_tag(:x, class: "c-btn__icon", aria_hidden: true), aria: { label: "Revoke #{org_membership.organization.name} organization membership" }, class: "c-btn c-btn--destructive c-btn--icon-alone",
data: { confirm: "Are you sure you want to remove them from #{org_membership.organization.name}?" } %>
data: { confirm: "Are you sure you want to remove #{org_membership.user.name} from #{org_membership.organization.name}?" } %>
<% end %>
</div>
</div>
@ -49,7 +49,7 @@
<% end %>
</div>
<% end %>
<button class="c-btn c-btn--secondary whitespace-nowrap w-100" type="button" data-modal-trigger data-modal-title="Add organization" data-modal-size="small" data-modal-content-selector="#add-organization">Add organization</button>
<button class="c-btn c-btn--secondary whitespace-nowrap w-100" type="button" data-modal-trigger data-modal-title="Add <%= @user.name %> to an organization" data-modal-size="small" data-modal-content-selector="#add-organization">Add organization</button>
<% end %>
<div id="add-organization" class="hidden">

View file

@ -10,16 +10,16 @@
<% if @user.access_locked? %>
<li><%= link_to "Unlock access", unlock_access_admin_user_path(@user), method: :patch, class: "c-link c-link--block" %></li>
<% end %>
<li><button type="button" class="c-btn w-100 align-left" data-modal-trigger data-modal-title="Export data" data-modal-size="small" data-modal-content-selector="#export-data">Export data</button></li>
<li><button type="button" class="c-btn w-100 align-left" data-modal-trigger data-modal-title="Merge accounts" data-modal-size="small" data-modal-content-selector="#merge-accounts">Merge accounts</button></li>
<li><button type="button" class="c-btn w-100 align-left" data-modal-trigger data-modal-title="Export <%= @user.name %>'s data" data-modal-size="small" data-modal-content-selector="#export-data">Export data</button></li>
<li><button type="button" class="c-btn w-100 align-left" data-modal-trigger data-modal-title="Merge users" data-modal-size="small" data-modal-content-selector="#merge-accounts">Merge users</button></li>
<% if @user.articles_count > 0 %>
<li><button type="button" class="c-btn w-100 align-left" data-modal-trigger data-modal-title="Unpublish all posts" data-modal-size="small" data-modal-content-selector="#unpublish-all-posts">Unpublish all posts</button></li>
<% end %>
<% if @user.identities.any? %>
<li><button type="button" class="c-btn w-100 align-left" data-modal-trigger data-modal-title="Remove social accounts" data-modal-size="medium" data-modal-content-selector="#remove-social-accounts">Remove social accounts</button></li>
<% end %>
<li><button type="button" class="c-btn c-btn--destructive w-100 align-left" data-modal-trigger data-modal-title="Banish for spam" data-modal-size="small" data-modal-content-selector="#banish-for-spam">Banish for spam</button></li>
<li><button type="button" class="c-btn c-btn--destructive w-100 align-left" data-modal-trigger data-modal-title="Delete user" data-modal-size="small" data-modal-content-selector="#delete-user">Delete user</button></li>
<li><button type="button" class="c-btn c-btn--destructive w-100 align-left" data-modal-trigger data-modal-title="Banish <%= @user.name %>" data-modal-size="small" data-modal-content-selector="#banish-for-spam">Banish user</button></li>
<li><button type="button" class="c-btn c-btn--destructive w-100 align-left" data-modal-trigger data-modal-title="Delete <%= @user.name %>'s account" data-modal-size="small" data-modal-content-selector="#delete-user">Delete user</button></li>
</ul>
</div>
</div>

View file

@ -1,20 +1,21 @@
<div id="banish-for-spam">
<div class="flex flex-col gap-4">
<% if @user.comments.where("created_at < ?", 100.days.ago).empty? && @user.created_at < 100.days.ago %>
<p><strong>This is extremely destructive.</strong> Banishing will delete all the user's existing content and change their username to <em>@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_###')", id: nil }) do %>
<p>This action is irreversible.</p>
<p>Once banished, we will delete all content created by <%= @user.name %> and change their username to @spam_###.</p>
<p>Be careful with this action.</p>
<%= form_for(@user, url: banish_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This action is irreversible. Banishing will delete all content by #{@user.name} and change their username to @spam_###.')", id: nil }) do %>
<button class="c-btn c-btn--primary c-btn--destructive">Banish User for spam</button>
<% end %>
<% elsif current_user.super_admin? || current_user.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><strong>This is extremely destructive.</strong> Banishing will delete all the user's existing content and change their username to <em>@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_###')", id: nil }) do %>
<button class="c-btn c-btn--primary c-btn--destructive">Banish User for spam</button>
<p>This action is irreversible.</p>
<p>Once banished, we will delete all content created by <%= @user.name %> and change their username to @spam_###.</p>
<p>Be careful with this action.</p>
<%= form_for(@user, url: banish_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This action is irreversible. Banishing will delete all content by #{@user.name} and change their username to @spam_###.')", id: nil }) do %>
<button class="c-btn c-btn--primary c-btn--destructive">Banish <%= @user.name %></button>
<% end %>
<% else %>
<div class="crayons-notice crayons-notice--danger">This is not a new user. Only Super Admins or Support Admins are allowed to banish this user.</div>
<div class="crayons-notice crayons-notice--danger">This is not a new user. Only Super Admins or Support Admins are allowed to banish <%= @user.name %>.</div>
<% end %>
</div>
</div>

View file

@ -1,13 +1,14 @@
<div id="delete-user">
<% if current_user.super_admin? %>
<%= form_for(@user, url: full_delete_admin_user_path(@user), html: { class: "flex flex-col gap-4", method: :post, onsubmit: "return confirm('Are you sure? This is extremely destructive and irreversible.')", id: nil }) do |f| %>
<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: { class: "flex flex-col gap-4", method: :post, onsubmit: "return confirm('Are you sure? This action is irreversible.')", id: nil }) do |f| %>
<p>This action is irreversible.</p>
<p>Once deleted, all data for <%= @user.name %> will be removed from our database.</p>
<p>Be careful with this action.</p>
<div>
<button class="c-btn c-btn--primary c-btn--destructive">Fully Delete User & All Activity</button>
<button class="c-btn c-btn--primary c-btn--destructive">Delete now</button>
</div>
<% end %>
<% else %>
<div class="crayons-notice crayons-notice--danger">Only <strong>Super Admins</strong> are allowed to fully delete users.</div>
<div class="crayons-notice crayons-notice--danger">Only <strong>Super Admins</strong> are allowed to delete users.</div>
<% end %>
</div>

View file

@ -1,19 +1,15 @@
<div id="export-data">
<div class="flex flex-col gap-4">
<p>
You can export a user's data here. Currently we only support exporting a user's posts and comments.
Choose betweem sending the exported data to either your Admin contact email, <%= ForemInstance.email %>,
or to <%= @user.name %>'s <a href="mailto:<%= @user.email %>">user email</a> directly.
</p>
<p>
You have the option of exporting to your Admin account to send to the user, or exporting to the user directly.
</p>
<p>
Exporting the data to your Admin account will send it to your contact
Admin email (<%= ForemInstance.email %>),
and exporting to the user will send it to their email (<%= @user.email %>).
Exported data includes a user's posts and comments.
</p>
<div class="flex gap-2">
<%= 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: "c-btn c-btn--secondary", params: { send_to_admin: true } %>
<%= 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: "c-btn c-btn--secondary", params: { send_to_admin: false } %>
<%= 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 #{ForemInstance.email}?" }, class: "c-btn c-btn--secondary", params: { send_to_admin: true } %>
<%= 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 #{@user.email}?" }, class: "c-btn c-btn--secondary", params: { send_to_admin: false } %>
</div>
</div>
</div>

View file

@ -1,16 +1,14 @@
<div id="merge-accounts">
<%= form_for(@user, url: merge_admin_user_path(@user),
html: { class: "flex flex-col gap-4", 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')", id: nil }) do |f| %>
<p>To merge a duplicate account, first make sure you are currently on the page of the user you want to <strong>keep</strong>. Below, add the user ID of the account to merge information from, and delete.</p>
<p>This action is irreversible.</p>
<p>Make sure you are currently on the page of the user you want to <strong>keep</strong>. Once merged, the account entered below will be merged and deleted.</p>
<div class="crayons-field mb-4">
<%= f.label :merge_user_id, "User ID", class: "crayons-field__label" %>
<p id="merge-user-description" class="crayons-field__description">
User ID for the user that will be <strong>deleted</strong> and merged.
</p>
<%= f.text_field :merge_user_id, placeholder: "1234", class: "crayons-textfield", type: "number", inputmode: "numeric", aria: { describedby: "merge-user-description" } %>
</div>
<div>
<%= f.button "Merge users", class: "c-btn c-btn--destructive c-btn--primary", type: "submit" %>
<%= f.button "Merge and delete", class: "c-btn c-btn--destructive c-btn--primary", type: "submit" %>
</div>
<% end %>
</div>

View file

@ -1,21 +1,21 @@
<div id="remove-social-accounts">
<div class="flex flex-col gap-4">
<p>At times, removing a user's social account will resolve certain sign-in issues that a user may be experiencing.</p>
<p>For example, users may experience issues related to their UID when creating a <%= community_name %> account. If a user creates an account by, first, deleting their original social account and, then, creating their new account with the same Twitter/GitHub username,
the user may be unable to register their new account. This occurs when a user's Twitter/GitHub account's UID does not match their identity's UID. For more information on whether a user's UID does not match their identity UID, the following third party tools can be
helpful:
<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>
or <a href="https://caius.github.io/github_id/#<%= @user.github_username %>" target="_blank" rel="noopener nofollow">Caius's GitHub ID Lookup Tool</a>
</p>
<p>Sometimes users encounter sign-in issues when they....</p>
<ol>
<li>create an account on <%= community_name %> with a social account, and</li>
<li>remove the original social account, and</li>
<li>attempt to sign in again using the same, removed social account.</li>
</ol>
<p>If this is the case, removing the social accounts below can help restore their social accounts. To verify if this is the case, follow steps 1 and 2 below. If verified, follow through all steps to restore their social accounts.</p>
<h3 class="crayons-subtitle-2">
How do I remove a social account?
How to restore a social account
</h3>
<ol>
<li>To start, click on one of the links provided above to check the user's social account UID.</li>
<li>Next, confirm whether or not the user's social account UID matches the user's identity UID.</li>
<li>If the social account UID does not match, delete the respective identity.</li>
<li>Finally, ask the user to reauthorize their social account via <%= app_url(user_settings_path(:account)) %></li>
<li>Check their social account's UID via these third party tools: <a href="https://tweeterid.com/?username=<%= @user.twitter_username %>" target="_blank" rel="noopener nofollow">Twitter UID</a> and <a href="https://caius.github.io/github_id/#<%= @user.github_username %>" target="_blank" rel="noopener nofollow">GitHub UID</a></li>
<li>Check whether or not it matches the corresponding UID below.</li>
<li>Remove the respective account if it doesn't match.</li>
<li>Ask the user to reauthorize their social account via <%= app_url(user_settings_path(:account)) %></li>
</ol>
<% @user.identities.each do |identity| %>

View file

@ -1,6 +1,7 @@
<div id="unpublish-all-posts">
<%= form_for(@user, url: unpublish_all_articles_admin_user_path(@user), html: { class: "flex flex-col gap-4", method: :post, onsubmit: "return confirm('Are you sure? All posts will be unavailable to the community.')", id: nil }) do |f| %>
<p>This will make any and all of the post links associated with this user unreachable. If the user is not suspended, they will have the ability to republish their posts.</p>
<p>Once unpublished, all posts by <%= @user.name %> will become hidden and only accessible to themselves.</p>
<p>If <%= @user.name %> is not suspended, they can still re-publish their posts from their dashboard.</p>
<div>
<button class="c-btn c-btn--destructive c-btn--primary">Unpublish all posts</button>
</div>

View file

@ -67,22 +67,22 @@ describe('Manage User Options', () => {
it(`should merge a user's account with another account`, () => {
openUserOptions(() => {
cy.findByRole('button', { name: 'Merge accounts' }).click();
cy.findByRole('button', { name: 'Merge users' }).click();
});
cy.getModal().within(() => {
cy.findByRole('spinbutton', { name: 'User ID' }).type('3');
cy.findByRole('button', { name: 'Merge users' }).click();
cy.findByRole('button', { name: 'Merge and delete' }).click();
});
});
it(`should banish a user for spam`, () => {
openUserOptions(() => {
cy.findByRole('button', { name: 'Banish for spam' }).click();
cy.findByRole('button', { name: 'Banish user' }).click();
});
cy.getModal().within(() => {
cy.findByRole('button', { name: 'Banish User for spam' }).click();
cy.findByRole('button', { name: 'Banish Trusted User 1 \\:/' }).click();
});
verifyAndDismissUserUpdatedMessage(
@ -97,7 +97,7 @@ describe('Manage User Options', () => {
cy.getModal().within(() => {
cy.findByRole('button', {
name: 'Fully Delete User & All Activity',
name: 'Delete now',
}).click();
});