fix(watchlist): disable Jellyseerr's watchlist for Plex users (#1398)
This PR resolves a conflict between the Plex and Jellyseerr watchlists by deactivating the Jellyseerr watchlist for Plex. fix #1344
This commit is contained in:
@@ -837,7 +837,8 @@ discoverRoutes.get<Record<string, unknown>, WatchlistResponse>(
|
|||||||
select: ['id', 'plexToken'],
|
select: ['id', 'plexToken'],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (activeUser) {
|
if (activeUser && !activeUser?.plexToken) {
|
||||||
|
// Non-Plex users can only see their own watchlist
|
||||||
const [result, total] = await getRepository(Watchlist).findAndCount({
|
const [result, total] = await getRepository(Watchlist).findAndCount({
|
||||||
where: { requestedBy: { id: activeUser?.id } },
|
where: { requestedBy: { id: activeUser?.id } },
|
||||||
relations: {
|
relations: {
|
||||||
@@ -866,6 +867,7 @@ discoverRoutes.get<Record<string, unknown>, WatchlistResponse>(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List watchlist from Plex
|
||||||
const plexTV = new PlexTvAPI(activeUser.plexToken);
|
const plexTV = new PlexTvAPI(activeUser.plexToken);
|
||||||
|
|
||||||
const watchlist = await plexTV.getWatchlist({ offset });
|
const watchlist = await plexTV.getWatchlist({ offset });
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import StatusBadge from '@app/components/StatusBadge';
|
|||||||
import useDeepLinks from '@app/hooks/useDeepLinks';
|
import useDeepLinks from '@app/hooks/useDeepLinks';
|
||||||
import useLocale from '@app/hooks/useLocale';
|
import useLocale from '@app/hooks/useLocale';
|
||||||
import useSettings from '@app/hooks/useSettings';
|
import useSettings from '@app/hooks/useSettings';
|
||||||
import { Permission, useUser } from '@app/hooks/useUser';
|
import { Permission, UserType, useUser } from '@app/hooks/useUser';
|
||||||
import globalMessages from '@app/i18n/globalMessages';
|
import globalMessages from '@app/i18n/globalMessages';
|
||||||
import ErrorPage from '@app/pages/_error';
|
import ErrorPage from '@app/pages/_error';
|
||||||
import { sortCrewPriority } from '@app/utils/creditHelpers';
|
import { sortCrewPriority } from '@app/utils/creditHelpers';
|
||||||
@@ -594,10 +594,13 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED && (
|
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED &&
|
||||||
|
user?.userType !== UserType.PLEX && (
|
||||||
<>
|
<>
|
||||||
{toggleWatchlist ? (
|
{toggleWatchlist ? (
|
||||||
<Tooltip content={intl.formatMessage(messages.addtowatchlist)}>
|
<Tooltip
|
||||||
|
content={intl.formatMessage(messages.addtowatchlist)}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
buttonType={'ghost'}
|
buttonType={'ghost'}
|
||||||
className="z-40 mr-2"
|
className="z-40 mr-2"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import RequestModal from '@app/components/RequestModal';
|
|||||||
import ErrorCard from '@app/components/TitleCard/ErrorCard';
|
import ErrorCard from '@app/components/TitleCard/ErrorCard';
|
||||||
import Placeholder from '@app/components/TitleCard/Placeholder';
|
import Placeholder from '@app/components/TitleCard/Placeholder';
|
||||||
import { useIsTouch } from '@app/hooks/useIsTouch';
|
import { useIsTouch } from '@app/hooks/useIsTouch';
|
||||||
import { Permission, useUser } from '@app/hooks/useUser';
|
import { Permission, UserType, useUser } from '@app/hooks/useUser';
|
||||||
import globalMessages from '@app/i18n/globalMessages';
|
import globalMessages from '@app/i18n/globalMessages';
|
||||||
import defineMessages from '@app/utils/defineMessages';
|
import defineMessages from '@app/utils/defineMessages';
|
||||||
import { withProperties } from '@app/utils/typeHelpers';
|
import { withProperties } from '@app/utils/typeHelpers';
|
||||||
@@ -373,7 +373,9 @@ const TitleCard = ({
|
|||||||
: intl.formatMessage(globalMessages.tvshow)}
|
: intl.formatMessage(globalMessages.tvshow)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{showDetail && currentStatus !== MediaStatus.BLACKLISTED && (
|
{showDetail &&
|
||||||
|
currentStatus !== MediaStatus.BLACKLISTED &&
|
||||||
|
user?.userType !== UserType.PLEX && (
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
{toggleWatchlist ? (
|
{toggleWatchlist ? (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import Season from '@app/components/TvDetails/Season';
|
|||||||
import useDeepLinks from '@app/hooks/useDeepLinks';
|
import useDeepLinks from '@app/hooks/useDeepLinks';
|
||||||
import useLocale from '@app/hooks/useLocale';
|
import useLocale from '@app/hooks/useLocale';
|
||||||
import useSettings from '@app/hooks/useSettings';
|
import useSettings from '@app/hooks/useSettings';
|
||||||
import { Permission, useUser } from '@app/hooks/useUser';
|
import { Permission, UserType, useUser } from '@app/hooks/useUser';
|
||||||
import globalMessages from '@app/i18n/globalMessages';
|
import globalMessages from '@app/i18n/globalMessages';
|
||||||
import Error from '@app/pages/_error';
|
import Error from '@app/pages/_error';
|
||||||
import { sortCrewPriority } from '@app/utils/creditHelpers';
|
import { sortCrewPriority } from '@app/utils/creditHelpers';
|
||||||
@@ -636,10 +636,13 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED && (
|
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED &&
|
||||||
|
user?.userType !== UserType.PLEX && (
|
||||||
<>
|
<>
|
||||||
{toggleWatchlist ? (
|
{toggleWatchlist ? (
|
||||||
<Tooltip content={intl.formatMessage(messages.addtowatchlist)}>
|
<Tooltip
|
||||||
|
content={intl.formatMessage(messages.addtowatchlist)}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
buttonType={'ghost'}
|
buttonType={'ghost'}
|
||||||
className="z-40 mr-2"
|
className="z-40 mr-2"
|
||||||
|
|||||||
Reference in New Issue
Block a user