Fixed: Mark as Failed errors (#5939)

Originally by Markus McDowall (cherry picked from commit 12fafb24578d39df2eabd2331558b2da961fe8b6)

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>

Fixes: #5907
Fixes: #5938
This commit is contained in:
nitsua 2021-02-14 10:28:30 -05:00 committed by GitHub
parent 90289de22c
commit a9792973ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -232,11 +232,9 @@ export const actionHandlers = handleThunks({
}));
const promise = createAjaxRequest({
url: '/history/failed',
url: `/history/failed/${id}`,
method: 'POST',
data: {
id
}
dataType: 'json'
}).request;
promise.done(() => {

View File

@ -77,11 +77,8 @@ export const actionHandlers = handleThunks({
} = payload;
const promise = createAjaxRequest({
url: '/history/failed',
method: 'POST',
data: {
id: historyId
}
url: `/history/failed/${historyId}`,
method: 'POST'
}).request;
promise.done(() => {

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.DecisionEngine.Specifications;
@ -39,6 +38,7 @@ namespace Radarr.Api.V3.History
Get("/since", x => GetHistorySince());
Get("/movie", x => GetMovieHistory());
Post("/failed", x => MarkAsFailed());
Post(@"/failed/(?<id>[\d]{1,10})", x => MarkAsFailed((int)x.Id));
}
protected HistoryResource MapToResource(MovieHistory model, bool includeMovie)
@ -130,10 +130,18 @@ namespace Radarr.Api.V3.History
return _historyService.GetByMovieId(movieId, eventType).Select(h => MapToResource(h, includeMovie)).ToList();
}
// v4 TODO: Getting the ID from the form is atypical, consider removing.
private object MarkAsFailed()
{
var id = (int)Request.Form.Id;
return MarkAsFailed(id);
}
private object MarkAsFailed(int id)
{
_failedDownloadService.MarkAsFailed(id);
return new object();
}
}