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

Replace existence check with optional chaining (#5742)

This commit is contained in:
Peter Santos 2024-08-17 02:58:01 -04:00 committed by GitHub
parent cc22fbc042
commit 1da9b548ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 21 additions and 21 deletions

View file

@ -92,7 +92,7 @@ function getImgUrl(item, user) {
if (item.BackdropImageTags?.length) {
return getBackdropImageUrl(item, imageOptions, apiClient);
} else {
if (item.MediaType === 'Photo' && user && user.Policy.EnableContentDownloading) {
if (item.MediaType === 'Photo' && user?.Policy.EnableContentDownloading) {
return apiClient.getItemDownloadUrl(item.Id);
}
imageOptions.type = 'Primary';
@ -171,7 +171,7 @@ export default function (options) {
if (actionButtonsOnTop) {
html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true);
if (appHost.supports('filedownload') && slideshowOptions.user && slideshowOptions.user.Policy.EnableContentDownloading) {
if (appHost.supports('filedownload') && slideshowOptions.user?.Policy.EnableContentDownloading) {
html += getIcon('file_download', 'btnDownload slideshowButton', true);
}
if (appHost.supports('sharing')) {
@ -189,7 +189,7 @@ export default function (options) {
html += '<div class="slideshowBottomBar hide">';
html += getIcon('play_arrow', 'btnSlideshowPause slideshowButton', true, true);
if (appHost.supports('filedownload') && slideshowOptions.user && slideshowOptions.user.Policy.EnableContentDownloading) {
if (appHost.supports('filedownload') && slideshowOptions?.user.Policy.EnableContentDownloading) {
html += getIcon('file_download', 'btnDownload slideshowButton', true);
}
if (appHost.supports('sharing')) {