Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting a user should show name #4943

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config.json

# ide
.idea
.vs

# log
yarn-error.log
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
- [Rasmus Krämer](https://github.com/rasmuslos)
- [ntarelix](https://github.com/ntarelix)
- [András Maróy](https://github.com/andrasmaroy)
- [Chris-Codes-It](https://github.com/Chris-Codes-It)

## Emby Contributors

Expand Down
12 changes: 7 additions & 5 deletions src/apps/dashboard/routes/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const UserProfiles: FunctionComponent = () => {
const showUserMenu = (elem: HTMLElement) => {
const card = dom.parentWithClass(elem, 'card');
const userId = card?.getAttribute('data-userid');
const username = card?.getAttribute('data-username');

if (!userId) {
console.error('Unexpected null user id');
Expand Down Expand Up @@ -106,7 +107,7 @@ const UserProfiles: FunctionComponent = () => {
break;

case 'delete':
deleteUser(userId);
deleteUser(userId, username);
}
}
}).catch(() => {
Expand All @@ -117,12 +118,13 @@ const UserProfiles: FunctionComponent = () => {
});
};

const deleteUser = (id: string) => {
const msg = globalize.translate('DeleteUserConfirmation');
const deleteUser = (id: string, username?: string | null) => {
const title = username ? globalize.translate('DeleteName', username) : globalize.translate('DeleteUser');
const text = globalize.translate('DeleteUserConfirmation');

confirm({
title: globalize.translate('DeleteUser'),
text: msg,
title,
text,
confirmText: globalize.translate('Delete'),
primary: 'delete'
}).then(function () {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/users/UserCardBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const UserCardBox: FunctionComponent<IProps> = ({ user = {} }: IProps) => {
</div>`;

return (
<div data-userid={user.Id} className={cssClass}>
<div data-userid={user.Id} data-username={user.Name} className={cssClass}>
<div className='cardBox visualCardBox'>
<div className='cardScalable visualCardBox-cardScalable'>
<div className='cardPadder cardPadder-square'></div>
Expand Down
1 change: 1 addition & 0 deletions src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"DeleteImage": "Delete Image",
"DeleteImageConfirmation": "Are you sure you wish to delete this image?",
"DeleteMedia": "Delete media",
"DeleteName": "Delete {0}",
"DeleteUser": "Delete User",
"DeleteUserConfirmation": "Are you sure you wish to delete this user?",
"Depressed": "Depressed",
Expand Down
Loading