@@ -44,30 +44,14 @@ personRoutes.get('/:id/combined_credits', async (req, res, next) => {
44
44
language : req . locale ?? ( req . query . language as string ) ,
45
45
} ) ;
46
46
47
- let castMedia = await Media . getRelatedMedia (
47
+ const castMedia = await Media . getRelatedMedia (
48
48
combinedCredits . cast . map ( ( result ) => result . id )
49
49
) ;
50
50
51
- let crewMedia = await Media . getRelatedMedia (
51
+ const crewMedia = await Media . getRelatedMedia (
52
52
combinedCredits . crew . map ( ( result ) => result . id )
53
53
) ;
54
54
55
- if ( settings . main . hideAvailable ) {
56
- castMedia = castMedia . filter (
57
- ( media ) =>
58
- ( media . mediaType === 'movie' || media . mediaType === 'tv' ) &&
59
- media . status !== MediaStatus . AVAILABLE &&
60
- media . status !== MediaStatus . PARTIALLY_AVAILABLE
61
- ) ;
62
-
63
- crewMedia = crewMedia . filter (
64
- ( media ) =>
65
- ( media . mediaType === 'movie' || media . mediaType === 'tv' ) &&
66
- media . status !== MediaStatus . AVAILABLE &&
67
- media . status !== MediaStatus . PARTIALLY_AVAILABLE
68
- ) ;
69
- }
70
-
71
55
return res . status ( 200 ) . json ( {
72
56
cast : combinedCredits . cast
73
57
. map ( ( result ) =>
@@ -79,7 +63,13 @@ personRoutes.get('/:id/combined_credits', async (req, res, next) => {
79
63
)
80
64
)
81
65
)
82
- . filter ( ( item ) => ! item . adult ) ,
66
+ . filter (
67
+ ( item ) =>
68
+ ! item . adult &&
69
+ ( ! settings . main . hideAvailable ||
70
+ ( item . mediaInfo ?. status !== MediaStatus . AVAILABLE &&
71
+ item . mediaInfo ?. status !== MediaStatus . PARTIALLY_AVAILABLE ) )
72
+ ) ,
83
73
crew : combinedCredits . crew
84
74
. map ( ( result ) =>
85
75
mapCrewCredits (
@@ -90,7 +80,13 @@ personRoutes.get('/:id/combined_credits', async (req, res, next) => {
90
80
)
91
81
)
92
82
)
93
- . filter ( ( item ) => ! item . adult ) ,
83
+ . filter (
84
+ ( item ) =>
85
+ ! item . adult &&
86
+ ( ! settings . main . hideAvailable ||
87
+ ( item . mediaInfo ?. status !== MediaStatus . AVAILABLE &&
88
+ item . mediaInfo ?. status !== MediaStatus . PARTIALLY_AVAILABLE ) )
89
+ ) ,
94
90
id : combinedCredits . id ,
95
91
} ) ;
96
92
} catch ( e ) {
0 commit comments