From 36d17fed6e4e1ca651a4e29f087b2abb53f794cf Mon Sep 17 00:00:00 2001 From: Brandon Cohen Date: Fri, 19 Aug 2022 06:21:29 -0400 Subject: [PATCH] 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. --- cypress/e2e/user/user-list.cy.ts | 5 ++++- src/components/UserList/index.tsx | 6 ++++-- src/i18n/locale/en.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/user/user-list.cy.ts b/cypress/e2e/user/user-list.cy.ts index d2593d51..f3dd86ef 100644 --- a/cypress/e2e/user/user-list.cy.ts +++ b/cypress/e2e/user/user-list.cy.ts @@ -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'); diff --git a/src/components/UserList/index.tsx b/src/components/UserList/index.tsx index 46d3ed1d..d928f29a 100644 --- a/src/components/UserList/index.tsx +++ b/src/components/UserList/index.tsx @@ -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: @@ -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={} > {intl.formatMessage(messages.deleteconfirm)} diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index bafda671..faaddf15 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -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",