mirror of
https://github.com/seerr-team/seerr.git
synced 2026-04-24 01:08:49 -04:00
fix: send availability notification if media is available before approval (#2819)
This commit is contained in:
@@ -667,11 +667,19 @@ export class MediaRequest {
|
||||
return;
|
||||
}
|
||||
|
||||
if (media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE) {
|
||||
logger.warn(
|
||||
'Media became available before request was approved. Skipping approval notification',
|
||||
if (
|
||||
this.status === MediaRequestStatus.APPROVED &&
|
||||
media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE
|
||||
) {
|
||||
logger.info(
|
||||
'Media is already available. Sending availability notification instead of approval.',
|
||||
{ label: 'Media Request', requestId: this.id, mediaId: this.media.id }
|
||||
);
|
||||
MediaRequest.sendNotification(
|
||||
this,
|
||||
media,
|
||||
Notification.MEDIA_AVAILABLE
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -727,6 +735,10 @@ export class MediaRequest {
|
||||
let notifySystem = true;
|
||||
|
||||
switch (type) {
|
||||
case Notification.MEDIA_AVAILABLE:
|
||||
event = `${entity.is4k ? '4K ' : ''}${mediaType} Now Available`;
|
||||
notifyAdmin = false;
|
||||
break;
|
||||
case Notification.MEDIA_APPROVED:
|
||||
event = `${entity.is4k ? '4K ' : ''}${mediaType} Request Approved`;
|
||||
notifyAdmin = false;
|
||||
|
||||
Reference in New Issue
Block a user