1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

apply suggestion

This commit is contained in:
grafixeyehero 2022-03-09 19:36:22 +03:00 committed by Bill Thornton
parent 08807dca19
commit 3886b7da1f
5 changed files with 10 additions and 18 deletions

View file

@ -26,25 +26,16 @@ const UserPasswordForm: FunctionComponent<IProps> = ({userId}: IProps) => {
window.ApiClient.getUser(userId).then(function (user) {
Dashboard.getCurrentUser().then(function (loggedInUser: { Policy: { IsAdministrator: boolean; }; }) {
if (!user.Id) {
throw new Error('Unexpected null user.Id');
}
if (!user.Policy) {
throw new Error('Unexpected null user.Policy');
}
if (!user.Id) {
throw new Error('Unexpected null user.Id');
}
if (!user.Configuration) {
throw new Error('Unexpected null user.Configuration');
}
LibraryMenu.setTitle(user.Name);
const showPasswordSection = true;
let showLocalAccessSection = false;
if (user.HasConfiguredPassword) {
@ -56,7 +47,7 @@ const UserPasswordForm: FunctionComponent<IProps> = ({userId}: IProps) => {
(page.querySelector('#fldCurrentPassword') as HTMLDivElement).classList.add('hide');
}
if (showPasswordSection && (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess)) {
if (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess) {
(page.querySelector('.passwordSection') as HTMLDivElement).classList.remove('hide');
} else {
(page.querySelector('.passwordSection') as HTMLDivElement).classList.add('hide');