feat: user delete modal shows username and requires confirmation (#2779)

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.
This commit is contained in:
Brandon Cohen
2022-08-19 06:21:29 -04:00
committed by GitHub
parent ac34328074
commit 36d17fed6e
3 changed files with 9 additions and 4 deletions

View File

@@ -54,7 +54,10 @@ describe('User List', () => {
.contains('Delete') .contains('Delete')
.click(); .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'); cy.intercept('/api/v1/user?take=10&skip=0&sort=displayname').as('user');

View File

@@ -49,7 +49,7 @@ const messages = defineMessages({
owner: 'Owner', owner: 'Owner',
admin: 'Admin', admin: 'Admin',
plexuser: 'Plex User', plexuser: 'Plex User',
deleteuser: 'Delete User', deleteuser: 'Delete {username}',
userdeleted: 'User deleted successfully!', userdeleted: 'User deleted successfully!',
userdeleteerror: 'Something went wrong while deleting the user.', userdeleteerror: 'Something went wrong while deleting the user.',
deleteconfirm: deleteconfirm:
@@ -246,7 +246,9 @@ const UserList = () => {
okDisabled={isDeleting} okDisabled={isDeleting}
okButtonType="danger" okButtonType="danger"
onCancel={() => setDeleteModal({ isOpen: false })} onCancel={() => setDeleteModal({ isOpen: false })}
title={intl.formatMessage(messages.deleteuser)} title={intl.formatMessage(messages.deleteuser, {
username: `${deleteModal.user?.username}`,
})}
iconSvg={<TrashIcon />} iconSvg={<TrashIcon />}
> >
{intl.formatMessage(messages.deleteconfirm)} {intl.formatMessage(messages.deleteconfirm)}

View File

@@ -855,7 +855,7 @@
"components.UserList.createlocaluser": "Create Local User", "components.UserList.createlocaluser": "Create Local User",
"components.UserList.creating": "Creating…", "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.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.displayName": "Display Name",
"components.UserList.edituser": "Edit User Permissions", "components.UserList.edituser": "Edit User Permissions",
"components.UserList.email": "Email Address", "components.UserList.email": "Email Address",