diff --git a/src/Ombi.Core/Engine/MovieRequestEngine.cs b/src/Ombi.Core/Engine/MovieRequestEngine.cs index ddb417ac8..80306fc0b 100644 --- a/src/Ombi.Core/Engine/MovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/MovieRequestEngine.cs @@ -160,7 +160,6 @@ namespace Ombi.Core.Engine results.Issues = request.Issues; results.Overview = request.Overview; results.PosterPath = request.PosterPath; - results.RequestedUser = request.RequestedUser; await MovieRepository.Update(results); return results; diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs index a1bf27512..51be4d7ab 100644 --- a/src/Ombi.Core/Engine/TvRequestEngine.cs +++ b/src/Ombi.Core/Engine/TvRequestEngine.cs @@ -62,6 +62,19 @@ namespace Ombi.Core.Engine }; } + // Check if we have auto approved the request, if we have then mark the episodes as approved + if (tvBuilder.ChildRequest.Approved) + { + foreach (var seasons in tvBuilder.ChildRequest.SeasonRequests) + { + foreach (var ep in seasons.Episodes) + { + ep.Approved = true; + ep.Requested = true; + } + } + } + await Audit.Record(AuditType.Added, AuditArea.TvRequest, $"Added Request {tv.Title}", Username); var existingRequest = await TvRepository.Get().FirstOrDefaultAsync(x => x.TvDbId == tv.Id); @@ -97,8 +110,8 @@ namespace Ombi.Core.Engine tvBuilder.ChildRequest.Id = 0; return await AddExistingRequest(tvBuilder.ChildRequest, existingRequest); } - // This is a new request + // This is a new request var newRequest = tvBuilder.CreateNewRequest(tv); return await AddRequest(newRequest.NewRequest); } diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html index ef5d1a463..fc6b4ad43 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html @@ -68,14 +68,16 @@ Available Processing Request +
- Pending Approval + Pending Approval - Not Yet Requested + Not Yet Requested +
diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index 672d8c089..d3f83eaa6 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -26,6 +26,12 @@ export class TvRequestChildrenComponent { debugger; request.approved = false; request.denied = true; + + request.seasonRequests.forEach((season) => { + season.episodes.forEach((ep) => { + ep.approved = false; + }); + }); this.requestService.updateChild(request) .subscribe(); } diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.html b/src/Ombi/ClientApp/app/search/moviesearch.component.html index 41d837eec..c3c8ed468 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.html +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.html @@ -52,16 +52,16 @@ Available {{result.quality}}p Processing Request -
- - Pending Approval - - - - Not Yet Requested - - - + + + + Pending Approval + + + + Not Yet Requested + + diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 9a61a206f..e9559ad0a 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -6,6 +6,7 @@ import 'rxjs/add/operator/map'; import "rxjs/add/operator/takeUntil"; import { SearchService } from '../services/search.service'; +import { AuthService } from '../auth/auth.service'; import { RequestService } from '../services/request.service'; import { NotificationService } from '../services/notification.service'; @@ -25,7 +26,9 @@ export class MovieSearchComponent implements OnInit, OnDestroy { result: IRequestEngineResult; searchApplied = false; - constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) { + constructor(private searchService: SearchService, private requestService: RequestService, + private notificationService: NotificationService, private authService : AuthService) { + this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value @@ -63,6 +66,10 @@ export class MovieSearchComponent implements OnInit, OnDestroy { request(searchResult: ISearchMovieResult) { searchResult.requested = true; + if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) { + searchResult.approved = true; + } + this.requestService.requestMovie(searchResult) .takeUntil(this.subscriptions) .subscribe(x => { diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index bbfd1bf66..bb2995f8a 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; -import {Router} from '@angular/router'; +import { Router } from '@angular/router'; import { Subject } from 'rxjs/Subject'; import 'rxjs/add/operator/debounceTime'; import 'rxjs/add/operator/distinctUntilChanged'; @@ -7,6 +7,7 @@ import 'rxjs/add/operator/map'; import "rxjs/add/operator/takeUntil"; import { SearchService } from '../services/search.service'; +import { AuthService } from '../auth/auth.service'; import { RequestService } from '../services/request.service'; import { NotificationService } from '../services/notification.service'; @@ -33,7 +34,8 @@ export class TvSearchComponent implements OnInit, OnDestroy { searchApplied = false; constructor(private searchService: SearchService, private requestService: RequestService, - private notificationService: NotificationService, private route : Router) { + private notificationService: NotificationService, private route: Router, private authService: AuthService) { + this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value @@ -151,7 +153,7 @@ export class TvSearchComponent implements OnInit, OnDestroy { this.searchService.getShowInformation(val.id) .takeUntil(this.subscriptions) .subscribe(x => { - this.updateItem(val,x); + this.updateItem(val, x); }); }); @@ -159,6 +161,9 @@ export class TvSearchComponent implements OnInit, OnDestroy { request(searchResult: ISearchTvResult) { searchResult.requested = true; + if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) { + searchResult.approved = true; + } this.requestService.requestTv(searchResult) .takeUntil(this.subscriptions) .subscribe(x => { diff --git a/src/Ombi/ClientApp/app/services/request.service.ts b/src/Ombi/ClientApp/app/services/request.service.ts index da0fe730b..8eba064b7 100644 --- a/src/Ombi/ClientApp/app/services/request.service.ts +++ b/src/Ombi/ClientApp/app/services/request.service.ts @@ -36,7 +36,7 @@ export class RequestService extends ServiceAuthHelpers { } updateMovieRequest(request: IMovieRequests): Observable { - return this.http.post(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); + return this.http.put(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); } getTvRequests(count: number, position: number): Observable {