mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
apply suggestion
This commit is contained in:
parent
08807dca19
commit
3886b7da1f
4
src/apiclient.d.ts
vendored
4
src/apiclient.d.ts
vendored
@ -93,7 +93,7 @@ declare module 'jellyfin-apiclient' {
|
|||||||
deleteItemImage(itemId: string, imageType: ImageType, imageIndex?: number): Promise<void>;
|
deleteItemImage(itemId: string, imageType: ImageType, imageIndex?: number): Promise<void>;
|
||||||
deleteItem(itemId: string): Promise<void>;
|
deleteItem(itemId: string): Promise<void>;
|
||||||
deleteLiveTvRecording(id: string): Promise<void>;
|
deleteLiveTvRecording(id: string): Promise<void>;
|
||||||
deleteUserImage(userId: string, imageType: string, imageIndex?: number): Promise<void>;
|
deleteUserImage(userId: string, imageType: ImageType, imageIndex?: number): Promise<void>;
|
||||||
deleteUser(userId: string): Promise<void>;
|
deleteUser(userId: string): Promise<void>;
|
||||||
detectBitrate(force: boolean): Promise<number>;
|
detectBitrate(force: boolean): Promise<number>;
|
||||||
deviceId(): string;
|
deviceId(): string;
|
||||||
@ -299,7 +299,7 @@ declare module 'jellyfin-apiclient' {
|
|||||||
updateVirtualFolderOptions(id: string, libraryOptions?: any): Promise<void>;
|
updateVirtualFolderOptions(id: string, libraryOptions?: any): Promise<void>;
|
||||||
uploadItemImage(itemId: string, imageType: ImageType, file: File): Promise<void>;
|
uploadItemImage(itemId: string, imageType: ImageType, file: File): Promise<void>;
|
||||||
uploadItemSubtitle(itemId: string, language: string, isForced: boolean, file: File): Promise<void>;
|
uploadItemSubtitle(itemId: string, language: string, isForced: boolean, file: File): Promise<void>;
|
||||||
uploadUserImage(userId: string, imageType: string, file: File): Promise<void>;
|
uploadUserImage(userId: string, imageType: ImageType, file: File): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppStore {
|
class AppStore {
|
||||||
|
@ -26,25 +26,16 @@ const UserPasswordForm: FunctionComponent<IProps> = ({userId}: IProps) => {
|
|||||||
|
|
||||||
window.ApiClient.getUser(userId).then(function (user) {
|
window.ApiClient.getUser(userId).then(function (user) {
|
||||||
Dashboard.getCurrentUser().then(function (loggedInUser: { Policy: { IsAdministrator: boolean; }; }) {
|
Dashboard.getCurrentUser().then(function (loggedInUser: { Policy: { IsAdministrator: boolean; }; }) {
|
||||||
if (!user.Id) {
|
|
||||||
throw new Error('Unexpected null user.Id');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user.Policy) {
|
if (!user.Policy) {
|
||||||
throw new Error('Unexpected null user.Policy');
|
throw new Error('Unexpected null user.Policy');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.Id) {
|
|
||||||
throw new Error('Unexpected null user.Id');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user.Configuration) {
|
if (!user.Configuration) {
|
||||||
throw new Error('Unexpected null user.Configuration');
|
throw new Error('Unexpected null user.Configuration');
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryMenu.setTitle(user.Name);
|
LibraryMenu.setTitle(user.Name);
|
||||||
|
|
||||||
const showPasswordSection = true;
|
|
||||||
let showLocalAccessSection = false;
|
let showLocalAccessSection = false;
|
||||||
|
|
||||||
if (user.HasConfiguredPassword) {
|
if (user.HasConfiguredPassword) {
|
||||||
@ -56,7 +47,7 @@ const UserPasswordForm: FunctionComponent<IProps> = ({userId}: IProps) => {
|
|||||||
(page.querySelector('#fldCurrentPassword') as HTMLDivElement).classList.add('hide');
|
(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');
|
(page.querySelector('.passwordSection') as HTMLDivElement).classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
(page.querySelector('.passwordSection') as HTMLDivElement).classList.add('hide');
|
(page.querySelector('.passwordSection') as HTMLDivElement).classList.add('hide');
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { ImageType } from '@thornbill/jellyfin-sdk/dist/generated-client';
|
||||||
import React, { FunctionComponent, useEffect, useState, useRef, useCallback } from 'react';
|
import React, { FunctionComponent, useEffect, useState, useRef, useCallback } from 'react';
|
||||||
|
|
||||||
import Dashboard from '../../scripts/clientUtils';
|
import Dashboard from '../../scripts/clientUtils';
|
||||||
@ -14,7 +15,7 @@ type IProps = {
|
|||||||
userId: string;
|
userId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserImagePage: FunctionComponent<IProps> = ({userId}: IProps) => {
|
const UserProfilePage: FunctionComponent<IProps> = ({userId}: IProps) => {
|
||||||
const [ userName, setUserName ] = useState('');
|
const [ userName, setUserName ] = useState('');
|
||||||
|
|
||||||
const element = useRef<HTMLDivElement>(null);
|
const element = useRef<HTMLDivElement>(null);
|
||||||
@ -111,7 +112,7 @@ const UserImagePage: FunctionComponent<IProps> = ({userId}: IProps) => {
|
|||||||
reader.onabort = onFileReaderAbort;
|
reader.onabort = onFileReaderAbort;
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
userImage.style.backgroundImage = 'url(' + reader.result + ')';
|
userImage.style.backgroundImage = 'url(' + reader.result + ')';
|
||||||
window.ApiClient.uploadUserImage(userId, 'Primary', file).then(function () {
|
window.ApiClient.uploadUserImage(userId, ImageType.Primary, file).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
reloadUser();
|
reloadUser();
|
||||||
});
|
});
|
||||||
@ -126,7 +127,7 @@ const UserImagePage: FunctionComponent<IProps> = ({userId}: IProps) => {
|
|||||||
globalize.translate('DeleteImage')
|
globalize.translate('DeleteImage')
|
||||||
).then(function () {
|
).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
window.ApiClient.deleteUserImage(userId, 'Primary').then(function () {
|
window.ApiClient.deleteUserImage(userId, ImageType.Primary).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
reloadUser();
|
reloadUser();
|
||||||
});
|
});
|
||||||
@ -188,4 +189,4 @@ const UserImagePage: FunctionComponent<IProps> = ({userId}: IProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default UserImagePage;
|
export default UserProfilePage;
|
@ -1,3 +1,3 @@
|
|||||||
<div id="userImagePage" data-role="page" class="page libraryPage userPreferencesPage userPasswordPage noSecondaryNavPage" data-title="${Profile}" data-menubutton="false">
|
<div id="userProfilePage" data-role="page" class="page libraryPage userPreferencesPage userPasswordPage noSecondaryNavPage" data-title="${Profile}" data-menubutton="false">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,7 +81,7 @@ import { appRouter } from '../components/appRouter';
|
|||||||
alias: '/myprofile.html',
|
alias: '/myprofile.html',
|
||||||
path: 'user/profile/index.html',
|
path: 'user/profile/index.html',
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
pageComponent: 'UserImagePage'
|
pageComponent: 'UserProfilePage'
|
||||||
});
|
});
|
||||||
|
|
||||||
defineRoute({
|
defineRoute({
|
||||||
|
Loading…
Reference in New Issue
Block a user