mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix itemHelper by adding Enums and update function declation
This commit is contained in:
parent
fd50b3af55
commit
5c60f99077
1 changed files with 12 additions and 8 deletions
|
@ -1,6 +1,10 @@
|
||||||
import { appHost } from './apphost';
|
import { appHost } from './apphost';
|
||||||
import globalize from '../scripts/globalize';
|
import globalize from '../scripts/globalize';
|
||||||
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
|
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
|
||||||
|
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
|
||||||
|
import { LocationType } from '@jellyfin/sdk/lib/generated-client/models/location-type';
|
||||||
|
import { RecordingStatus } from '@jellyfin/sdk/lib/generated-client/models/recording-status';
|
||||||
|
import { MediaType } from '@jellyfin/sdk/lib/generated-client/models/media-type';
|
||||||
|
|
||||||
export function getDisplayName(item, options = {}) {
|
export function getDisplayName(item, options = {}) {
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
@ -156,26 +160,26 @@ export function canEditImages (user, item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canEditSubtitles (user, item) {
|
export function canEditSubtitles (user, item) {
|
||||||
if (item.MediaType !== 'Video') {
|
if (item.MediaType !== MediaType.Video) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const itemType = item.Type;
|
const itemType = item.Type;
|
||||||
if (itemType === 'Recording' && item.Status !== 'Completed') {
|
if (itemType === BaseItemKind.Recording && item.Status !== RecordingStatus.Completed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (itemType === 'TvChannel'
|
if (itemType === BaseItemKind.TvChannel
|
||||||
|| itemType === 'Program'
|
|| itemType === BaseItemKind.Program
|
||||||
|| itemType === 'Timer'
|
|| itemType === 'Timer'
|
||||||
|| itemType === 'SeriesTimer'
|
|| itemType === 'SeriesTimer'
|
||||||
|| itemType === 'UserRootFolder'
|
|| itemType === BaseItemKind.UserRootFolder
|
||||||
|| itemType === 'UserView'
|
|| itemType === BaseItemKind.UserView
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isLocalItem(item)) {
|
if (isLocalItem(item)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (item.LocationType === 'Virtual') {
|
if (item.LocationType === LocationType.Virtual) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return user.Policy.EnableSubtitleManagement
|
return user.Policy.EnableSubtitleManagement
|
||||||
|
@ -327,7 +331,7 @@ export default {
|
||||||
canIdentify: canIdentify,
|
canIdentify: canIdentify,
|
||||||
canEdit: canEdit,
|
canEdit: canEdit,
|
||||||
canEditImages: canEditImages,
|
canEditImages: canEditImages,
|
||||||
canEditSubtitles: canEditSubtitles,
|
canEditSubtitles,
|
||||||
canShare: canShare,
|
canShare: canShare,
|
||||||
enableDateAddedDisplay: enableDateAddedDisplay,
|
enableDateAddedDisplay: enableDateAddedDisplay,
|
||||||
canMarkPlayed: canMarkPlayed,
|
canMarkPlayed: canMarkPlayed,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue