Fixed: Blocklisting pending releases

This commit is contained in:
Mark McDowall
2021-08-01 14:36:16 -07:00
committed by ta264
parent ede981f737
commit e2745c5956
7 changed files with 104 additions and 50 deletions
+6 -1
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Download;
@@ -32,6 +33,7 @@ namespace Readarr.Api.V1.Queue
private readonly IFailedDownloadService _failedDownloadService;
private readonly IIgnoredDownloadService _ignoredDownloadService;
private readonly IProvideDownloadClient _downloadClientProvider;
private readonly IBlocklistService _blocklistService;
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
IQueueService queueService,
@@ -40,7 +42,8 @@ namespace Readarr.Api.V1.Queue
ITrackedDownloadService trackedDownloadService,
IFailedDownloadService failedDownloadService,
IIgnoredDownloadService ignoredDownloadService,
IProvideDownloadClient downloadClientProvider)
IProvideDownloadClient downloadClientProvider,
IBlocklistService blocklistService)
: base(broadcastSignalRMessage)
{
_queueService = queueService;
@@ -49,6 +52,7 @@ namespace Readarr.Api.V1.Queue
_failedDownloadService = failedDownloadService;
_ignoredDownloadService = ignoredDownloadService;
_downloadClientProvider = downloadClientProvider;
_blocklistService = blocklistService;
_qualityComparer = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
}
@@ -199,6 +203,7 @@ namespace Readarr.Api.V1.Queue
if (pendingRelease != null)
{
_blocklistService.Block(pendingRelease.RemoteBook, "Pending book manually blocklisted");
_pendingReleaseService.RemovePendingQueueItems(pendingRelease.Id);
return null;