1
0
Fork 0
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:
chinkara 2024-03-07 10:12:27 +01:00
parent fd50b3af55
commit 5c60f99077

View file

@ -1,6 +1,10 @@
import { appHost } from './apphost';
import globalize from '../scripts/globalize';
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 = {}) {
if (!item) {
@ -156,26 +160,26 @@ export function canEditImages (user, item) {
}
export function canEditSubtitles (user, item) {
if (item.MediaType !== 'Video') {
if (item.MediaType !== MediaType.Video) {
return false;
}
const itemType = item.Type;
if (itemType === 'Recording' && item.Status !== 'Completed') {
if (itemType === BaseItemKind.Recording && item.Status !== RecordingStatus.Completed) {
return false;
}
if (itemType === 'TvChannel'
|| itemType === 'Program'
if (itemType === BaseItemKind.TvChannel
|| itemType === BaseItemKind.Program
|| itemType === 'Timer'
|| itemType === 'SeriesTimer'
|| itemType === 'UserRootFolder'
|| itemType === 'UserView'
|| itemType === BaseItemKind.UserRootFolder
|| itemType === BaseItemKind.UserView
) {
return false;
}
if (isLocalItem(item)) {
return false;
}
if (item.LocationType === 'Virtual') {
if (item.LocationType === LocationType.Virtual) {
return false;
}
return user.Policy.EnableSubtitleManagement
@ -327,7 +331,7 @@ export default {
canIdentify: canIdentify,
canEdit: canEdit,
canEditImages: canEditImages,
canEditSubtitles: canEditSubtitles,
canEditSubtitles,
canShare: canShare,
enableDateAddedDisplay: enableDateAddedDisplay,
canMarkPlayed: canMarkPlayed,