Skip to content

Commit

Permalink
feat: user delete modal shows username and requires confirmation (#2779)
Browse files Browse the repository at this point in the history
The delete user modal will now show the user that is being deleted and the delete button will now
ask you to confirm deletion similar to the delete request button.
  • Loading branch information
OwsleyJr committed Aug 19, 2022
1 parent ac34328 commit 36d17fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cypress/e2e/user/user-list.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ describe('User List', () => {
.contains('Delete')
.click();

cy.get('[data-testid=modal-title]').should('contain', 'Delete User');
cy.get('[data-testid=modal-title]').should(
'contain',
`Delete ${testUser.displayName}`
);

cy.intercept('/api/v1/user?take=10&skip=0&sort=displayname').as('user');

Expand Down
6 changes: 4 additions & 2 deletions src/components/UserList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const messages = defineMessages({
owner: 'Owner',
admin: 'Admin',
plexuser: 'Plex User',
deleteuser: 'Delete User',
deleteuser: 'Delete {username}',
userdeleted: 'User deleted successfully!',
userdeleteerror: 'Something went wrong while deleting the user.',
deleteconfirm:
Expand Down Expand Up @@ -246,7 +246,9 @@ const UserList = () => {
okDisabled={isDeleting}
okButtonType="danger"
onCancel={() => setDeleteModal({ isOpen: false })}
title={intl.formatMessage(messages.deleteuser)}
title={intl.formatMessage(messages.deleteuser, {
username: `${deleteModal.user?.username}`,
})}
iconSvg={<TrashIcon />}
>
{intl.formatMessage(messages.deleteconfirm)}
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@
"components.UserList.createlocaluser": "Create Local User",
"components.UserList.creating": "Creating…",
"components.UserList.deleteconfirm": "Are you sure you want to delete this user? All of their request data will be permanently removed.",
"components.UserList.deleteuser": "Delete User",
"components.UserList.deleteuser": "Delete {username}",
"components.UserList.displayName": "Display Name",
"components.UserList.edituser": "Edit User Permissions",
"components.UserList.email": "Email Address",
Expand Down

0 comments on commit 36d17fe

Please sign in to comment.