mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix guest stars being listed twice on details page
This commit is contained in:
parent
167f2d2614
commit
ebeeaa2948
1 changed files with 15 additions and 8 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { PersonKind } from '@jellyfin/sdk/lib/generated-client/models/person-kind';
|
||||||
import { intervalToDuration } from 'date-fns';
|
import { intervalToDuration } from 'date-fns';
|
||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
import escapeHtml from 'escape-html';
|
import escapeHtml from 'escape-html';
|
||||||
|
@ -822,8 +823,18 @@ function setInitialCollapsibleState(page, item, apiClient, context, user) {
|
||||||
page.querySelector('#specialsCollapsible').classList.add('hide');
|
page.querySelector('#specialsCollapsible').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
renderCast(page, item);
|
const cast = [];
|
||||||
renderGuestCast(page, item);
|
const guestCast = [];
|
||||||
|
(item.People || []).forEach(p => {
|
||||||
|
if (p.Type === PersonKind.GuestStar) {
|
||||||
|
guestCast.push(p);
|
||||||
|
} else {
|
||||||
|
cast.push(p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
renderCast(page, item, cast);
|
||||||
|
renderGuestCast(page, item, guestCast);
|
||||||
|
|
||||||
if (item.PartCount && item.PartCount > 1) {
|
if (item.PartCount && item.PartCount > 1) {
|
||||||
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
||||||
|
@ -1803,9 +1814,7 @@ function renderSpecials(page, item, user) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCast(page, item) {
|
function renderCast(page, item, people) {
|
||||||
const people = item.People || [];
|
|
||||||
|
|
||||||
if (!people.length) {
|
if (!people.length) {
|
||||||
page.querySelector('#castCollapsible').classList.add('hide');
|
page.querySelector('#castCollapsible').classList.add('hide');
|
||||||
return;
|
return;
|
||||||
|
@ -1825,9 +1834,7 @@ function renderCast(page, item) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderGuestCast(page, item) {
|
function renderGuestCast(page, item, people) {
|
||||||
const people = (item.People || []).filter(p => p.Type === 'GuestStar');
|
|
||||||
|
|
||||||
if (!people.length) {
|
if (!people.length) {
|
||||||
page.querySelector('#guestCastCollapsible').classList.add('hide');
|
page.querySelector('#guestCastCollapsible').classList.add('hide');
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue