mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(notif): only send MEDIA_AVAILABLE notifications for non-declined requests (#2343)
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
EntitySubscriberInterface,
|
||||
EventSubscriber,
|
||||
getRepository,
|
||||
Not,
|
||||
UpdateEvent,
|
||||
} from 'typeorm';
|
||||
import TheMovieDb from '../api/themoviedb';
|
||||
@@ -26,7 +27,11 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
|
||||
if (entity.mediaType === MediaType.MOVIE) {
|
||||
const requestRepository = getRepository(MediaRequest);
|
||||
const relatedRequests = await requestRepository.find({
|
||||
where: { media: entity, is4k },
|
||||
where: {
|
||||
media: entity,
|
||||
is4k,
|
||||
status: Not(MediaRequestStatus.DECLINED),
|
||||
},
|
||||
});
|
||||
|
||||
if (relatedRequests.length > 0) {
|
||||
@@ -88,7 +93,11 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
|
||||
|
||||
for (const changedSeasonNumber of changedSeasons) {
|
||||
const requests = await requestRepository.find({
|
||||
where: { media: entity, is4k: true },
|
||||
where: {
|
||||
media: entity,
|
||||
is4k,
|
||||
status: Not(MediaRequestStatus.DECLINED),
|
||||
},
|
||||
});
|
||||
const request = requests.find(
|
||||
(request) =>
|
||||
|
Reference in New Issue
Block a user