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:
fallenbagel
2026-04-04 05:42:13 +08:00
parent 6f9b743ea9
commit abc8fbe352

View File

@@ -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;