diff --git a/src/Ombi.Notifications/NotificationMessageCurlys.cs b/src/Ombi.Notifications/NotificationMessageCurlys.cs index b178f0545..1e1224342 100644 --- a/src/Ombi.Notifications/NotificationMessageCurlys.cs +++ b/src/Ombi.Notifications/NotificationMessageCurlys.cs @@ -49,7 +49,7 @@ namespace Ombi.Notifications } Overview = req?.Overview; Year = req?.ReleaseDate.Year.ToString(); - + DenyReason = req?.DeniedReason; if (req?.RequestType == RequestType.Movie) { PosterImage = string.Format((req?.PosterPath ?? string.Empty).StartsWith("/", StringComparison.InvariantCultureIgnoreCase) @@ -88,6 +88,7 @@ namespace Ombi.Notifications UserName = req?.RequestedUser?.UserName; } + DenyReason = req?.DeniedReason; Alias = (req?.RequestedUser?.Alias.HasValue() ?? false) ? req?.RequestedUser?.Alias : req?.RequestedUser?.UserName; Title = title; RequestedDate = req?.RequestedDate.ToString("D"); @@ -126,6 +127,7 @@ namespace Ombi.Notifications { title = req?.ParentRequest.Title; } + DenyReason = req?.DeniedReason; ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty; ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName; RequestedUser = req?.RequestedUser?.UserName; @@ -217,7 +219,6 @@ namespace Ombi.Notifications public string UserName { get; set; } public string IssueUser => UserName; public string Alias { get; set; } - public string Title { get; set; } public string RequestedDate { get; set; } public string Type { get; set; } @@ -235,6 +236,7 @@ namespace Ombi.Notifications public string IssueSubject { get; set; } public string NewIssueComment { get; set; } public string UserPreference { get; set; } + public string DenyReason { get; set; } // System Defined private string LongDate => DateTime.Now.ToString("D"); @@ -269,6 +271,7 @@ namespace Ombi.Notifications {nameof(UserName),UserName}, {nameof(Alias),Alias}, {nameof(UserPreference),UserPreference}, + {nameof(DenyReason),DenyReason}, }; } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts index 16a1511e9..4bb43f3fe 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts @@ -55,6 +55,10 @@ export interface IAlbumUpdateModel { id: number; } +export interface IDenyAlbumModel extends IAlbumUpdateModel { + reason: string; +} + export interface IFullBaseRequest extends IBaseRequest { imdbId: string; overview: string; @@ -117,6 +121,10 @@ export interface ITvUpdateModel { id: number; } +export interface ITvDenyModel extends ITvUpdateModel { + reason: string; +} + export enum OrderType { RequestedDateAsc = 1, RequestedDateDesc = 2, diff --git a/src/Ombi/ClientApp/app/requests/music/musicrequests.component.html b/src/Ombi/ClientApp/app/requests/music/musicrequests.component.html index c4c903da2..5b274589b 100644 --- a/src/Ombi/ClientApp/app/requests/music/musicrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/music/musicrequests.component.html @@ -92,7 +92,7 @@
{{ 'Requests.Denied' | translate }} - +
@@ -265,4 +265,15 @@ - \ No newline at end of file + + + + + + Please enter a rejection reason, the user will be notified of this: + + + + + + \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/music/musicrequests.component.ts b/src/Ombi/ClientApp/app/requests/music/musicrequests.component.ts index e70d44a38..7cda9ab29 100644 --- a/src/Ombi/ClientApp/app/requests/music/musicrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/music/musicrequests.component.ts @@ -34,6 +34,9 @@ export class MusicRequestsComponent implements OnInit { public orderType: OrderType = OrderType.RequestedDateDesc; public OrderType = OrderType; + public denyDisplay: boolean; + public requestToDeny: IAlbumRequest; + public rejectionReason: string; public totalAlbums: number = 100; private currentlyLoaded: number; @@ -126,23 +129,22 @@ export class MusicRequestsComponent implements OnInit { } public deny(request: IAlbumRequest) { - request.denied = true; - this.denyRequest(request); + this.requestToDeny = request; + this.denyDisplay = true; } - // public selectRootFolder(searchResult: IAlbumRequest, rootFolderSelected: IRadarrRootFolder, event: any) { - // event.preventDefault(); - // // searchResult.rootPathOverride = rootFolderSelected.id; - // this.setOverride(searchResult); - // this.updateRequest(searchResult); - // } - - // public selectQualityProfile(searchResult: IMovieRequests, profileSelected: IRadarrProfile, event: any) { - // event.preventDefault(); - // searchResult.qualityOverride = profileSelected.id; - // this.setOverride(searchResult); - // this.updateRequest(searchResult); - // } + public denyRequest() { + this.requestService.denyAlbum({ id: this.requestToDeny.id, reason: this.rejectionReason }) + .subscribe(x => { + if (x.result) { + this.notificationService.success( + `Request for ${this.requestToDeny.title} has been denied successfully`); + } else { + this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage); + this.requestToDeny.denied = false; + } + }); + } public reportIssue(catId: IIssueCategory, req: IAlbumRequest) { this.issueRequest = req; @@ -266,19 +268,6 @@ export class MusicRequestsComponent implements OnInit { }); } - private denyRequest(request: IAlbumRequest) { - this.requestService.denyAlbum({ id: request.id }) - .subscribe(x => { - if (x.result) { - this.notificationService.success( - `Request for ${request.title} has been denied successfully`); - } else { - this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage); - request.denied = false; - } - }); - } - private loadInit() { this.requestService.getAlbumRequests(this.amountToLoad, 0, this.orderType, this.filter) .subscribe(x => { diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html index 1492a00f9..003ceea6a 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html @@ -21,7 +21,8 @@ - +
@@ -76,7 +77,9 @@ {{ep.airDate | amLocal | amDateFormat: 'L' }} - + + +
@@ -98,3 +101,12 @@
+ + + Please enter a rejection reason, the user will be notified of this: + + + + + + diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index bc792a55b..2c2145fb9 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -11,6 +11,10 @@ export class TvRequestChildrenComponent { @Input() public childRequests: IChildRequests[]; @Input() public isAdmin: boolean; @Input() public currentUser: string; + + public denyDisplay: boolean; + public requestToDeny: IChildRequests; + public rejectionReason: string; @Output() public requestDeleted = new EventEmitter(); @@ -57,20 +61,26 @@ export class TvRequestChildrenComponent { public deny(request: IChildRequests) { request.denied = true; + this.requestToDeny = request; + this.denyDisplay = true; request.seasonRequests.forEach((season) => { season.episodes.forEach((ep) => { ep.approved = false; }); }); - this.requestService.denyChild({ id: request.id }) + } + + public denyRequest() { + this.requestService.denyChild({ id: this.requestToDeny.id, reason: this.rejectionReason }) .subscribe(x => { + this.denyDisplay = false; if (x.result) { this.notificationService.success( `Request has been denied successfully`); } else { this.notificationService.warning("Request Denied", x.message ? x.message : x.errorMessage); - request.approved = false; + this.requestToDeny.approved = false; } }); } diff --git a/src/Ombi/ClientApp/app/services/request.service.ts b/src/Ombi/ClientApp/app/services/request.service.ts index c157cb72f..f7e2b3875 100644 --- a/src/Ombi/ClientApp/app/services/request.service.ts +++ b/src/Ombi/ClientApp/app/services/request.service.ts @@ -5,8 +5,8 @@ import { HttpClient } from "@angular/common/http"; import { Observable } from "rxjs"; import { TreeNode } from "primeng/primeng"; -import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IDenyMovieModel, IFilter, IMovieRequestModel, - IMovieRequests, IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces"; +import { FilterType, IAlbumRequest, IAlbumRequestModel, IAlbumUpdateModel, IChildRequests, IDenyAlbumModel, IDenyMovieModel, IFilter, + IMovieRequestModel, IMovieRequests, IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvDenyModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces"; import { ITvRequestViewModel } from "../interfaces"; import { ServiceHelpers } from "./service.helpers"; @@ -118,7 +118,7 @@ export class RequestService extends ServiceHelpers { return this.http.put(`${this.url}tv/child`, JSON.stringify(child), {headers: this.headers}); } - public denyChild(child: ITvUpdateModel): Observable { + public denyChild(child: ITvDenyModel): Observable { return this.http.put(`${this.url}tv/deny`, JSON.stringify(child), {headers: this.headers}); } @@ -161,7 +161,7 @@ export class RequestService extends ServiceHelpers { return this.http.post(`${this.url}music/Approve`, JSON.stringify(Album), {headers: this.headers}); } - public denyAlbum(Album: IAlbumUpdateModel): Observable { + public denyAlbum(Album: IDenyAlbumModel): Observable { return this.http.put(`${this.url}music/Deny`, JSON.stringify(Album), {headers: this.headers}); }