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:
Gauthier
2025-02-26 10:47:11 +01:00
committed by GitHub
parent 27112be933
commit 4eddbaa71b
4 changed files with 111 additions and 101 deletions

View File

@@ -837,7 +837,8 @@ discoverRoutes.get<Record<string, unknown>, WatchlistResponse>(
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({
where: { requestedBy: { id: activeUser?.id } },
relations: {
@@ -866,6 +867,7 @@ discoverRoutes.get<Record<string, unknown>, WatchlistResponse>(
});
}
// List watchlist from Plex
const plexTV = new PlexTvAPI(activeUser.plexToken);
const watchlist = await plexTV.getWatchlist({ offset });

View File

@@ -25,7 +25,7 @@ import StatusBadge from '@app/components/StatusBadge';
import useDeepLinks from '@app/hooks/useDeepLinks';
import useLocale from '@app/hooks/useLocale';
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 ErrorPage from '@app/pages/_error';
import { sortCrewPriority } from '@app/utils/creditHelpers';
@@ -594,10 +594,13 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
</Button>
</Tooltip>
)}
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED && (
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED &&
user?.userType !== UserType.PLEX && (
<>
{toggleWatchlist ? (
<Tooltip content={intl.formatMessage(messages.addtowatchlist)}>
<Tooltip
content={intl.formatMessage(messages.addtowatchlist)}
>
<Button
buttonType={'ghost'}
className="z-40 mr-2"

View File

@@ -8,7 +8,7 @@ import RequestModal from '@app/components/RequestModal';
import ErrorCard from '@app/components/TitleCard/ErrorCard';
import Placeholder from '@app/components/TitleCard/Placeholder';
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 defineMessages from '@app/utils/defineMessages';
import { withProperties } from '@app/utils/typeHelpers';
@@ -373,7 +373,9 @@ const TitleCard = ({
: intl.formatMessage(globalMessages.tvshow)}
</div>
</div>
{showDetail && currentStatus !== MediaStatus.BLACKLISTED && (
{showDetail &&
currentStatus !== MediaStatus.BLACKLISTED &&
user?.userType !== UserType.PLEX && (
<div className="flex flex-col gap-1">
{toggleWatchlist ? (
<Button

View File

@@ -28,7 +28,7 @@ import Season from '@app/components/TvDetails/Season';
import useDeepLinks from '@app/hooks/useDeepLinks';
import useLocale from '@app/hooks/useLocale';
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 Error from '@app/pages/_error';
import { sortCrewPriority } from '@app/utils/creditHelpers';
@@ -636,10 +636,13 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</Button>
</Tooltip>
)}
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED && (
{data?.mediaInfo?.status !== MediaStatus.BLACKLISTED &&
user?.userType !== UserType.PLEX && (
<>
{toggleWatchlist ? (
<Tooltip content={intl.formatMessage(messages.addtowatchlist)}>
<Tooltip
content={intl.formatMessage(messages.addtowatchlist)}
>
<Button
buttonType={'ghost'}
className="z-40 mr-2"