mirror of
https://github.com/seerr-team/seerr.git
synced 2026-05-23 16:28:49 -04:00
fix: send availability notification if media is available before approval
When media becomes available before a pending request is approved, send a MEDIA_AVAILABLE notification to the requester instead of silently skipping all notifications. fix #2809
This commit is contained in:
@@ -668,11 +668,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;
|
||||
}
|
||||
|
||||
@@ -728,6 +736,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