fix: modified all instances of request button show state

pull/3636/head
Brandon Cohen 1 year ago
parent 76f57550fa
commit 3369adfb9a
No known key found for this signature in database
GPG Key ID: 3E759476348594C9

@ -129,6 +129,7 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
} }
const hasRequestable = const hasRequestable =
settings.currentSettings.movieEnabled &&
hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], { hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], {
type: 'or', type: 'or',
}) && }) &&
@ -237,6 +238,10 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
</div> </div>
<div className="media-title"> <div className="media-title">
<div className="media-status"> <div className="media-status">
{settings.currentSettings.movieEnabled &&
hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], {
type: 'or',
}) && (
<StatusBadge <StatusBadge
status={collectionStatus} status={collectionStatus}
downloadItem={downloadStatus} downloadItem={downloadStatus}
@ -245,6 +250,7 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
(part) => (part.mediaInfo?.downloadStatus ?? []).length > 0 (part) => (part.mediaInfo?.downloadStatus ?? []).length > 0
)} )}
/> />
)}
{settings.currentSettings.movie4kEnabled && {settings.currentSettings.movie4kEnabled &&
hasPermission( hasPermission(
[Permission.REQUEST_4K, Permission.REQUEST_4K_MOVIE], [Permission.REQUEST_4K, Permission.REQUEST_4K_MOVIE],
@ -340,6 +346,7 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
id={title.id} id={title.id}
image={title.posterPath} image={title.posterPath}
status={title.mediaInfo?.status} status={title.mediaInfo?.status}
status4k={title.mediaInfo?.status4k}
summary={title.overview} summary={title.overview}
title={title.title} title={title.title}
userScore={title.voteAverage} userScore={title.voteAverage}

@ -61,6 +61,7 @@ const ListView = ({
id={title.id} id={title.id}
image={title.posterPath} image={title.posterPath}
status={title.mediaInfo?.status} status={title.mediaInfo?.status}
status4k={title.mediaInfo?.status4k}
summary={title.overview} summary={title.overview}
title={title.title} title={title.title}
userScore={title.voteAverage} userScore={title.voteAverage}
@ -79,6 +80,7 @@ const ListView = ({
id={title.id} id={title.id}
image={title.posterPath} image={title.posterPath}
status={title.mediaInfo?.status} status={title.mediaInfo?.status}
status4k={title.mediaInfo?.status4k}
summary={title.overview} summary={title.overview}
title={title.name} title={title.name}
userScore={title.voteAverage} userScore={title.voteAverage}

@ -72,8 +72,12 @@ const CreateIssueModal = ({
const availableSeasons = (data?.mediaInfo?.seasons ?? []) const availableSeasons = (data?.mediaInfo?.seasons ?? [])
.filter( .filter(
(season) => (season) =>
season.status === MediaStatus.AVAILABLE || (settings.currentSettings.seriesEnabled &&
season.status === MediaStatus.PARTIALLY_AVAILABLE || hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_TV], {
type: 'or',
}) &&
(season.status === MediaStatus.AVAILABLE ||
season.status === MediaStatus.PARTIALLY_AVAILABLE)) ||
(settings.currentSettings.series4kEnabled && (settings.currentSettings.series4kEnabled &&
hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_TV], { hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_TV], {
type: 'or', type: 'or',

@ -468,7 +468,8 @@ const ManageSlideOver = ({
{intl.formatMessage(messages.manageModalAdvanced)} {intl.formatMessage(messages.manageModalAdvanced)}
</h3> </h3>
<div className="space-y-2"> <div className="space-y-2">
{data?.mediaInfo.status !== MediaStatus.AVAILABLE && ( {data?.mediaInfo.status !== MediaStatus.AVAILABLE &&
settings.currentSettings.seriesEnabled && (
<Button <Button
onClick={() => markAvailable()} onClick={() => markAvailable()}
className="w-full" className="w-full"

@ -154,6 +154,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
const mediaLinks: PlayButtonLink[] = []; const mediaLinks: PlayButtonLink[] = [];
if ( if (
settings.currentSettings.movieEnabled &&
plexUrl && plexUrl &&
hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], { hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], {
type: 'or', type: 'or',
@ -314,6 +315,17 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
</div> </div>
<div className="media-title"> <div className="media-title">
<div className="media-status"> <div className="media-status">
{settings.currentSettings.movieEnabled &&
hasPermission(
[
Permission.MANAGE_REQUESTS,
Permission.REQUEST,
Permission.REQUEST_MOVIE,
],
{
type: 'or',
}
) && (
<StatusBadge <StatusBadge
status={data.mediaInfo?.status} status={data.mediaInfo?.status}
downloadItem={data.mediaInfo?.downloadStatus} downloadItem={data.mediaInfo?.downloadStatus}
@ -324,6 +336,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
plexUrl={plexUrl} plexUrl={plexUrl}
serviceUrl={data.mediaInfo?.serviceUrl} serviceUrl={data.mediaInfo?.serviceUrl}
/> />
)}
{settings.currentSettings.movie4kEnabled && {settings.currentSettings.movie4kEnabled &&
hasPermission( hasPermission(
[ [
@ -379,7 +392,8 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
tmdbId={data.id} tmdbId={data.id}
onUpdate={() => revalidate()} onUpdate={() => revalidate()}
/> />
{(data.mediaInfo?.status === MediaStatus.AVAILABLE || {((settings.currentSettings.movieEnabled &&
data.mediaInfo?.status === MediaStatus.AVAILABLE) ||
(settings.currentSettings.movie4kEnabled && (settings.currentSettings.movie4kEnabled &&
hasPermission( hasPermission(
[Permission.REQUEST_4K, Permission.REQUEST_4K_MOVIE], [Permission.REQUEST_4K, Permission.REQUEST_4K_MOVIE],

@ -159,7 +159,8 @@ const NotificationTypeSelector = ({
{ type: 'or' } { type: 'or' }
) || ) ||
// Cannot submit non-4K movie requests OR has Auto-Approve perms for non-4K movies // Cannot submit non-4K movie requests OR has Auto-Approve perms for non-4K movies
((!hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], { ((!settings.currentSettings.movieEnabled ||
!hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], {
type: 'or', type: 'or',
}) || }) ||
hasPermission( hasPermission(
@ -167,7 +168,8 @@ const NotificationTypeSelector = ({
{ type: 'or' } { type: 'or' }
)) && )) &&
// Cannot submit non-4K series requests OR has Auto-Approve perms for non-4K series // Cannot submit non-4K series requests OR has Auto-Approve perms for non-4K series
(!hasPermission([Permission.REQUEST, Permission.REQUEST_TV], { (!settings.currentSettings.seriesEnabled ||
!hasPermission([Permission.REQUEST, Permission.REQUEST_TV], {
type: 'or', type: 'or',
}) || }) ||
hasPermission( hasPermission(

@ -145,6 +145,7 @@ const PersonDetails = () => {
summary={media.overview} summary={media.overview}
mediaType={media.mediaType as 'movie' | 'tv'} mediaType={media.mediaType as 'movie' | 'tv'}
status={media.mediaInfo?.status} status={media.mediaInfo?.status}
status4k={media.mediaInfo?.status4k}
canExpand canExpand
/> />
{media.character && ( {media.character && (

@ -273,7 +273,9 @@ const RequestButton = ({
: Permission.REQUEST_TV, : Permission.REQUEST_TV,
], ],
{ type: 'or' } { type: 'or' }
) ) &&
((settings.currentSettings.movieEnabled && mediaType === 'movie') ||
(settings.currentSettings.seriesEnabled && mediaType === 'tv'))
) { ) {
buttons.push({ buttons.push({
id: 'request', id: 'request',
@ -292,7 +294,8 @@ const RequestButton = ({
}) && }) &&
media && media &&
media.status !== MediaStatus.AVAILABLE && media.status !== MediaStatus.AVAILABLE &&
!isShowComplete !isShowComplete &&
settings.currentSettings.seriesEnabled
) { ) {
buttons.push({ buttons.push({
id: 'request-more', id: 'request-more',

@ -73,7 +73,10 @@ const StatusBadge = ({
type: 'or', type: 'or',
} }
) && ) &&
(!is4k || ((!is4k &&
(mediaType === 'movie'
? settings.currentSettings.movieEnabled
: settings.currentSettings.seriesEnabled)) ||
(mediaType === 'movie' (mediaType === 'movie'
? settings.currentSettings.movie4kEnabled ? settings.currentSettings.movie4kEnabled
: settings.currentSettings.series4kEnabled)) : settings.currentSettings.series4kEnabled))

@ -149,7 +149,13 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
const mediaLinks: PlayButtonLink[] = []; const mediaLinks: PlayButtonLink[] = [];
if (plexUrl) { if (
settings.currentSettings.seriesEnabled &&
plexUrl &&
hasPermission([Permission.REQUEST, Permission.REQUEST_TV], {
type: 'or',
})
) {
mediaLinks.push({ mediaLinks.push({
text: intl.formatMessage(messages.playonplex), text: intl.formatMessage(messages.playonplex),
url: plexUrl, url: plexUrl,
@ -337,6 +343,17 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</div> </div>
<div className="media-title"> <div className="media-title">
<div className="media-status"> <div className="media-status">
{settings.currentSettings.seriesEnabled &&
hasPermission(
[
Permission.MANAGE_REQUESTS,
Permission.REQUEST,
Permission.REQUEST_TV,
],
{
type: 'or',
}
) && (
<StatusBadge <StatusBadge
status={data.mediaInfo?.status} status={data.mediaInfo?.status}
downloadItem={data.mediaInfo?.downloadStatus} downloadItem={data.mediaInfo?.downloadStatus}
@ -347,6 +364,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
plexUrl={plexUrl} plexUrl={plexUrl}
serviceUrl={data.mediaInfo?.serviceUrl} serviceUrl={data.mediaInfo?.serviceUrl}
/> />
)}
{settings.currentSettings.series4kEnabled && {settings.currentSettings.series4kEnabled &&
hasPermission( hasPermission(
[ [
@ -404,8 +422,12 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
isShowComplete={isComplete} isShowComplete={isComplete}
is4kShowComplete={is4kComplete} is4kShowComplete={is4kComplete}
/> />
{(data.mediaInfo?.status === MediaStatus.AVAILABLE || {((settings.currentSettings.seriesEnabled &&
data.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || hasPermission([Permission.REQUEST, Permission.REQUEST_TV], {
type: 'or',
}) &&
(data.mediaInfo?.status === MediaStatus.AVAILABLE ||
data?.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE)) ||
(settings.currentSettings.series4kEnabled && (settings.currentSettings.series4kEnabled &&
hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_TV], { hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_TV], {
type: 'or', type: 'or',
@ -524,6 +546,18 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
.reverse() .reverse()
.filter((season) => season.seasonNumber !== 0) .filter((season) => season.seasonNumber !== 0)
.map((season) => { .map((season) => {
const showNon4k =
settings.currentSettings.seriesEnabled &&
hasPermission(
[
Permission.MANAGE_REQUESTS,
Permission.REQUEST,
Permission.REQUEST_TV,
],
{
type: 'or',
}
);
const show4k = const show4k =
settings.currentSettings.series4kEnabled && settings.currentSettings.series4kEnabled &&
hasPermission( hasPermission(
@ -588,11 +622,14 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</div> </div>
{((!mSeason && {((!mSeason &&
request?.status === MediaRequestStatus.APPROVED) || request?.status === MediaRequestStatus.APPROVED) ||
mSeason?.status === MediaStatus.PROCESSING) && ( mSeason?.status === MediaStatus.PROCESSING) &&
showNon4k && (
<> <>
<div className="hidden md:flex"> <div className="hidden md:flex">
<Badge badgeType="primary"> <Badge badgeType="primary">
{intl.formatMessage(globalMessages.requested)} {intl.formatMessage(
globalMessages.requested
)}
</Badge> </Badge>
</div> </div>
<div className="flex md:hidden"> <div className="flex md:hidden">
@ -604,7 +641,8 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
)} )}
{((!mSeason && {((!mSeason &&
request?.status === MediaRequestStatus.PENDING) || request?.status === MediaRequestStatus.PENDING) ||
mSeason?.status === MediaStatus.PENDING) && ( mSeason?.status === MediaStatus.PENDING) &&
showNon4k && (
<> <>
<div className="hidden md:flex"> <div className="hidden md:flex">
<Badge badgeType="warning"> <Badge badgeType="warning">
@ -612,12 +650,15 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</Badge> </Badge>
</div> </div>
<div className="flex md:hidden"> <div className="flex md:hidden">
<StatusBadgeMini status={MediaStatus.PENDING} /> <StatusBadgeMini
status={MediaStatus.PENDING}
/>
</div> </div>
</> </>
)} )}
{mSeason?.status === {mSeason?.status ===
MediaStatus.PARTIALLY_AVAILABLE && ( MediaStatus.PARTIALLY_AVAILABLE &&
showNon4k && (
<> <>
<div className="hidden md:flex"> <div className="hidden md:flex">
<Badge badgeType="success"> <Badge badgeType="success">
@ -633,11 +674,14 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</div> </div>
</> </>
)} )}
{mSeason?.status === MediaStatus.AVAILABLE && ( {mSeason?.status === MediaStatus.AVAILABLE &&
showNon4k && (
<> <>
<div className="hidden md:flex"> <div className="hidden md:flex">
<Badge badgeType="success"> <Badge badgeType="success">
{intl.formatMessage(globalMessages.available)} {intl.formatMessage(
globalMessages.available
)}
</Badge> </Badge>
</div> </div>
<div className="flex md:hidden"> <div className="flex md:hidden">

Loading…
Cancel
Save