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

Merge pull request #3877 from Callum17/bugfix/release-fix_itemcontextmenu_fails_to_update_for_items_with_no_image_metadata

This commit is contained in:
Bill Thornton 2022-09-23 23:39:54 -04:00 committed by GitHub
commit 72d538e902
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ import { appRouter } from '../appRouter';
let currentTimeElement; let currentTimeElement;
let nowPlayingImageElement; let nowPlayingImageElement;
let nowPlayingImageUrl;
let nowPlayingTextElement; let nowPlayingTextElement;
let nowPlayingUserData; let nowPlayingUserData;
let muteButton; let muteButton;
@ -488,7 +489,6 @@ import { appRouter } from '../appRouter';
return null; return null;
} }
let currentImgUrl;
function updateNowPlayingInfo(state) { function updateNowPlayingInfo(state) {
const nowPlayingItem = state.NowPlayingItem; const nowPlayingItem = state.NowPlayingItem;
@ -524,17 +524,14 @@ import { appRouter } from '../appRouter';
height: imgHeight height: imgHeight
})) : null; })) : null;
let isRefreshing = false; if (url !== nowPlayingImageUrl) {
if (url !== currentImgUrl) {
currentImgUrl = url;
isRefreshing = true;
if (url) { if (url) {
imageLoader.lazyImage(nowPlayingImageElement, url); nowPlayingImageUrl = url;
imageLoader.lazyImage(nowPlayingImageElement, nowPlayingImageUrl);
nowPlayingImageElement.style.display = null; nowPlayingImageElement.style.display = null;
nowPlayingTextElement.style.marginLeft = null; nowPlayingTextElement.style.marginLeft = null;
} else { } else {
nowPlayingImageUrl = null;
nowPlayingImageElement.style.backgroundImage = ''; nowPlayingImageElement.style.backgroundImage = '';
nowPlayingImageElement.style.display = 'none'; nowPlayingImageElement.style.display = 'none';
nowPlayingTextElement.style.marginLeft = '1em'; nowPlayingTextElement.style.marginLeft = '1em';
@ -542,7 +539,6 @@ import { appRouter } from '../appRouter';
} }
if (nowPlayingItem.Id) { if (nowPlayingItem.Id) {
if (isRefreshing) {
const apiClient = ServerConnections.getApiClient(nowPlayingItem.ServerId); const apiClient = ServerConnections.getApiClient(nowPlayingItem.ServerId);
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
const userData = item.UserData || {}; const userData = item.UserData || {};
@ -571,7 +567,6 @@ import { appRouter } from '../appRouter';
} }
nowPlayingUserData.innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton mediaButton paper-icon-button-light" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-likes="' + likes + '" data-isfavorite="' + (userData.IsFavorite) + '"><span class="material-icons favorite" aria-hidden="true"></span></button>'; nowPlayingUserData.innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton mediaButton paper-icon-button-light" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-likes="' + likes + '" data-isfavorite="' + (userData.IsFavorite) + '"><span class="material-icons favorite" aria-hidden="true"></span></button>';
}); });
}
} else { } else {
nowPlayingUserData.innerHTML = ''; nowPlayingUserData.innerHTML = '';
} }