From 95609913270e0b8678be5c848292d03a2f2e03e8 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 8 Jul 2024 22:25:26 +0300 Subject: [PATCH] Fixed: Removing pending release without blocklisting (cherry picked from commit 0c883f78862f88ff37cd5539da4f569fbe3c93ed) Closes #4892 --- frontend/src/Activity/Queue/RemoveQueueItemModal.tsx | 3 ++- src/Lidarr.Api.V1/Queue/QueueController.cs | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx b/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx index 2502c8226..f25bb0d1b 100644 --- a/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx +++ b/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx @@ -118,6 +118,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) { { key: 'blocklistAndSearch', value: translate('BlocklistAndSearch'), + isDisabled: isPending, hint: multipleSelected ? translate('BlocklistAndSearchMultipleHint') : translate('BlocklistAndSearchHint'), @@ -130,7 +131,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) { : translate('BlocklistOnlyHint'), }, ]; - }, [multipleSelected]); + }, [isPending, multipleSelected]); const handleRemovalMethodChange = useCallback( ({ value }: { value: RemovalMethod }) => { diff --git a/src/Lidarr.Api.V1/Queue/QueueController.cs b/src/Lidarr.Api.V1/Queue/QueueController.cs index 3a584b23e..23808a566 100644 --- a/src/Lidarr.Api.V1/Queue/QueueController.cs +++ b/src/Lidarr.Api.V1/Queue/QueueController.cs @@ -71,7 +71,7 @@ namespace Lidarr.Api.V1.Queue if (pendingRelease != null) { - Remove(pendingRelease); + Remove(pendingRelease, blocklist); return; } @@ -114,7 +114,7 @@ namespace Lidarr.Api.V1.Queue foreach (var pendingRelease in pendingToRemove.DistinctBy(p => p.Id)) { - Remove(pendingRelease); + Remove(pendingRelease, blocklist); } foreach (var trackedDownload in trackedToRemove.DistinctBy(t => t.DownloadItem.DownloadId)) @@ -263,9 +263,13 @@ namespace Lidarr.Api.V1.Queue } } - private void Remove(NzbDrone.Core.Queue.Queue pendingRelease) + private void Remove(NzbDrone.Core.Queue.Queue pendingRelease, bool blocklist) { - _blocklistService.Block(pendingRelease.RemoteAlbum, "Pending release manually blocklisted"); + if (blocklist) + { + _blocklistService.Block(pendingRelease.RemoteAlbum, "Pending release manually blocklisted"); + } + _pendingReleaseService.RemovePendingQueueItems(pendingRelease.Id); }