mirror of
https://github.com/seerr-team/seerr.git
synced 2026-08-02 02:57:49 -04:00
fix: don't delete requests when removing media from arr (#3288)
This commit is contained in:
@@ -203,17 +203,21 @@ class Media {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
||||
public resetServiceData(): void {
|
||||
this.serviceId = null;
|
||||
this.serviceId4k = null;
|
||||
this.externalServiceId = null;
|
||||
this.externalServiceId4k = null;
|
||||
this.externalServiceSlug = null;
|
||||
this.externalServiceSlug4k = null;
|
||||
this.ratingKey = null;
|
||||
this.ratingKey4k = null;
|
||||
this.jellyfinMediaId = null;
|
||||
this.jellyfinMediaId4k = null;
|
||||
public resetServiceData(is4k?: boolean): void {
|
||||
if (is4k === undefined || !is4k) {
|
||||
this.serviceId = null;
|
||||
this.externalServiceId = null;
|
||||
this.externalServiceSlug = null;
|
||||
this.ratingKey = null;
|
||||
this.jellyfinMediaId = null;
|
||||
}
|
||||
if (is4k === undefined || is4k) {
|
||||
this.serviceId4k = null;
|
||||
this.externalServiceId4k = null;
|
||||
this.externalServiceSlug4k = null;
|
||||
this.ratingKey4k = null;
|
||||
this.jellyfinMediaId4k = null;
|
||||
}
|
||||
}
|
||||
|
||||
@AfterLoad()
|
||||
|
||||
@@ -280,8 +280,16 @@ mediaRoutes.delete(
|
||||
throw new Error('TVDB ID not found');
|
||||
}
|
||||
await (service as SonarrAPI).removeSeries(tvdbId);
|
||||
|
||||
for (const season of media.seasons) {
|
||||
season[is4k ? 'status4k' : 'status'] = MediaStatus.DELETED;
|
||||
}
|
||||
}
|
||||
|
||||
media[is4k ? 'status4k' : 'status'] = MediaStatus.DELETED;
|
||||
media.resetServiceData(is4k);
|
||||
await mediaRepository.save(media);
|
||||
|
||||
return res.status(204).send();
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
|
||||
@@ -149,7 +149,6 @@ const ManageSlideOver = ({
|
||||
await axios.delete(
|
||||
`/api/v1/media/${data.mediaInfo.id}/file?is4k=${is4k}`
|
||||
);
|
||||
await axios.delete(`/api/v1/media/${data.mediaInfo.id}`);
|
||||
} catch (e) {
|
||||
if (!axios.isAxiosError(e) || e.response?.status !== 404) {
|
||||
addToast(intl.formatMessage(messages.removemediaerror), {
|
||||
|
||||
@@ -359,7 +359,6 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
|
||||
await axios.delete(
|
||||
`/api/v1/media/${request.media.id}/file?is4k=${request.is4k}`
|
||||
);
|
||||
await axios.delete(`/api/v1/media/${request.media.id}`);
|
||||
} catch (e) {
|
||||
if (!axios.isAxiosError(e) || e.response?.status !== 404) {
|
||||
addToast(intl.formatMessage(messages.removemediaerror), {
|
||||
|
||||
Reference in New Issue
Block a user