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
10 changed files with 21 additions and 21 deletions
+3 -3
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')) {