mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
Finished #18
This commit is contained in:
parent
8df742abe3
commit
0ac114d987
7 changed files with 214 additions and 17 deletions
|
@ -65,6 +65,7 @@ namespace PlexRequests.UI.Modules
|
|||
HeadphoneApi = hpApi;
|
||||
|
||||
Post["/approve", true] = async (x, ct) => await Approve((int)Request.Form.requestid, (string)Request.Form.qualityId);
|
||||
Post["/deny", true] = async (x, ct) => await DenyRequest((int)Request.Form.requestid, (string)Request.Form.reason);
|
||||
Post["/approveall", true] = async (x, ct) => await ApproveAll();
|
||||
Post["/approveallmovies", true] = async (x, ct) => await ApproveAllMovies();
|
||||
Post["/approvealltvshows", true] = async (x, ct) => await ApproveAllTVShows();
|
||||
|
@ -262,7 +263,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
|
||||
var requests = await Service.GetAllAsync();
|
||||
requests = requests.Where(x => x.CanApprove && x.Type == RequestType.Movie);
|
||||
requests = requests.Where(x => x.CanApprove && x.Type == RequestType.Movie);
|
||||
var requestedModels = requests as RequestedModel[] ?? requests.ToArray();
|
||||
if (!requestedModels.Any())
|
||||
{
|
||||
|
@ -491,6 +492,24 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<Response> DenyRequest(int requestId, string reason)
|
||||
{
|
||||
// Get the request from the DB
|
||||
var request = await Service.GetAsync(requestId);
|
||||
|
||||
// Deny it
|
||||
request.Denied = true;
|
||||
request.DeniedReason = reason;
|
||||
|
||||
// Update the new value
|
||||
var result = await Service.UpdateRequestAsync(request);
|
||||
|
||||
return result
|
||||
? Response.AsJson(new JsonResponseModel { Result = true, Message = "Request has been denied" })
|
||||
: Response.AsJson(new JsonResponseModel { Result = false, Message = "An error happened, could not update the DB" });
|
||||
|
||||
}
|
||||
|
||||
private bool SendMovie(CouchPotatoSettings settings, RequestedModel r, ICouchPotatoApi cp)
|
||||
{
|
||||
Log.Info("Adding movie to CP : {0}", r.Title);
|
||||
|
|
|
@ -178,6 +178,8 @@ namespace PlexRequests.UI.Modules
|
|||
Available = movie.Available,
|
||||
Admin = IsAdmin,
|
||||
IssueId = movie.IssueId,
|
||||
Denied = movie.Denied,
|
||||
DeniedReason = movie.DeniedReason,
|
||||
Qualities = qualities.ToArray()
|
||||
}).ToList();
|
||||
|
||||
|
@ -249,6 +251,8 @@ namespace PlexRequests.UI.Modules
|
|||
Available = tv.Available,
|
||||
Admin = IsAdmin,
|
||||
IssueId = tv.IssueId,
|
||||
Denied = tv.Denied,
|
||||
DeniedReason = tv.DeniedReason,
|
||||
TvSeriesRequestType = tv.SeasonsRequested,
|
||||
Qualities = qualities.ToArray(),
|
||||
Episodes = tv.Episodes.ToArray(),
|
||||
|
@ -290,6 +294,8 @@ namespace PlexRequests.UI.Modules
|
|||
Available = album.Available,
|
||||
Admin = IsAdmin,
|
||||
IssueId = album.IssueId,
|
||||
Denied = album.Denied,
|
||||
DeniedReason = album.DeniedReason,
|
||||
TvSeriesRequestType = album.SeasonsRequested,
|
||||
MusicBrainzId = album.MusicBrainzId,
|
||||
ArtistName = album.ArtistName
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace PlexRequests.UI.Modules
|
|||
a.TrackEventAsync(Category.Wizard, Action.Start, "Started the wizard", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
|
||||
var settings = await PlexRequestSettings.GetSettingsAsync();
|
||||
|
||||
if (settings.Wizard)
|
||||
{
|
||||
return Context.GetRedirect("~/search");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue