Small fix when denying a request with a reason, we wasn't updating the ui

This commit is contained in:
TidusJar 2019-01-21 14:06:30 +00:00
parent 1f59693c7e
commit 3e4b2a8e9f
3 changed files with 7 additions and 4 deletions

View file

@ -326,6 +326,7 @@ namespace Ombi.Core.Engine
return new RequestEngineResult return new RequestEngineResult
{ {
Result = true,
Message = "Request successfully deleted", Message = "Request successfully deleted",
}; };
} }

View file

@ -87,9 +87,6 @@
<span *ngIf="request.approved && !request.available" id="processingRequestLabel" class="label label-info" <span *ngIf="request.approved && !request.available" id="processingRequestLabel" class="label label-info"
[translate]="'Common.ProcessingRequest'"></span> [translate]="'Common.ProcessingRequest'"></span>
<span *ngIf="request.denied" class="label label-danger" id="requestDeclinedLabel" [translate]="'Common.RequestDenied'"></span> <span *ngIf="request.denied" class="label label-danger" id="requestDeclinedLabel" [translate]="'Common.RequestDenied'"></span>
<span *ngIf="request.deniedReason" title="{{request.deniedReason}}">
<i class="fa fa-info-circle"></i>
</span>
<span *ngIf="!request.approved && !request.availble && !request.denied" id="pendingApprovalLabel" <span *ngIf="!request.approved && !request.availble && !request.denied" id="pendingApprovalLabel"
class="label label-warning" [translate]="'Common.PendingApproval'"></span> class="label label-warning" [translate]="'Common.PendingApproval'"></span>

View file

@ -135,15 +135,20 @@ export class MovieRequestsComponent implements OnInit {
public deny(request: IMovieRequests) { public deny(request: IMovieRequests) {
this.requestToDeny = request; this.requestToDeny = request;
this.denyDisplay = true; this.denyDisplay = true;
} }
public denyRequest() { public denyRequest() {
this.requestService.denyMovie({ id: this.requestToDeny.id, reason: this.rejectionReason }) this.requestService.denyMovie({ id: this.requestToDeny.id, reason: this.rejectionReason })
.subscribe(x => { .subscribe(x => {
debugger;
this.denyDisplay = false; this.denyDisplay = false;
if (x.result) { if (x.result) {
this.notificationService.success( this.notificationService.success(
`Request for ${this.requestToDeny.title} has been denied successfully`); `Request for ${this.requestToDeny.title} has been denied successfully`);
const index = this.movieRequests.indexOf(this.requestToDeny, 0);
if (index > -1) {
this.movieRequests[index].denied = true;
}
} else { } else {
this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage); this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage);
this.requestToDeny.denied = false; this.requestToDeny.denied = false;