From 19fe4e342efe5578c26ab8ba7ee2f2e64bbc9418 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Tue, 1 Mar 2022 08:43:45 +0000 Subject: [PATCH] fix(requests): :bug: Fixed the issue where we could no longer approve TV Requests from the requests list --- src/Ombi.Store/Entities/Requests/BaseRequest.cs | 2 +- src/Ombi.Store/Entities/Requests/MovieRequests.cs | 3 +++ .../components/movies-grid/movies-grid.component.ts | 4 ++-- .../components/options/request-options.component.html | 2 +- .../components/options/request-options.component.ts | 8 +++++--- .../requests-list/components/requests-list.component.ts | 4 ++-- .../requests-list/components/tv-grid/tv-grid.component.ts | 4 ++-- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Ombi.Store/Entities/Requests/BaseRequest.cs b/src/Ombi.Store/Entities/Requests/BaseRequest.cs index 596041a51..f26bcc8ba 100644 --- a/src/Ombi.Store/Entities/Requests/BaseRequest.cs +++ b/src/Ombi.Store/Entities/Requests/BaseRequest.cs @@ -24,6 +24,6 @@ namespace Ombi.Store.Entities.Requests [NotMapped] - public bool CanApprove => !Approved && !Available; + public virtual bool CanApprove => !Approved && !Available; } } \ No newline at end of file diff --git a/src/Ombi.Store/Entities/Requests/MovieRequests.cs b/src/Ombi.Store/Entities/Requests/MovieRequests.cs index 49189a387..415efded2 100644 --- a/src/Ombi.Store/Entities/Requests/MovieRequests.cs +++ b/src/Ombi.Store/Entities/Requests/MovieRequests.cs @@ -81,5 +81,8 @@ namespace Ombi.Store.Entities.Requests return string.Empty; } } + + [NotMapped] + public override bool CanApprove => !Approved && !Available || !Approved4K && !Available4K; } } diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts index de3f8de39..b283821ed 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts @@ -5,6 +5,7 @@ import { Observable, combineLatest, forkJoin, merge, of as observableOf } from ' import { catchError, map, startWith, switchMap } from 'rxjs/operators'; import { AuthService } from "../../../auth/auth.service"; +import { FeaturesFacade } from "../../../state/features/features.facade"; import { MatPaginator } from "@angular/material/paginator"; import { MatSort } from "@angular/material/sort"; import { MatTableDataSource } from "@angular/material/table"; @@ -13,7 +14,6 @@ import { RequestServiceV2 } from "../../../services/requestV2.service"; import { SelectionModel } from "@angular/cdk/collections"; import { StorageService } from "../../../shared/storage/storage-service"; import { TranslateService } from "@ngx-translate/core"; -import { FeaturesFacade } from "../../../state/features/features.facade"; @Component({ templateUrl: "./movies-grid.component.html", @@ -43,7 +43,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { private storageKeyGridCount = "Movie_DefaultGridCount"; private storageKeyCurrentFilter = "Movie_DefaultFilter"; - @Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean }>(); + @Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean, has4kRequest: boolean, hasRegularRequest: boolean }>(); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html index 72c0cdce3..dc1c04467 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html @@ -2,7 +2,7 @@ {{'Requests.RequestPanel.Delete' | translate}} - + {{'Requests.RequestPanel.Approve' | translate}} diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.ts index 673f978e7..30a55335c 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef } from '@angular/material/bottom-sheet'; import { MessageService, RequestService } from '../../../services'; import { IRequestEngineResult, RequestType } from '../../../interfaces'; @@ -10,7 +10,7 @@ import { firstValueFrom, Observable } from 'rxjs'; selector: 'request-options', templateUrl: './request-options.component.html', }) -export class RequestOptionsComponent { +export class RequestOptionsComponent implements OnInit { public RequestType = RequestType; @@ -19,6 +19,9 @@ export class RequestOptionsComponent { private messageService: MessageService, private bottomSheetRef: MatBottomSheetRef, private translate: TranslateService) { } + ngOnInit(): void { + console.log(this.data); + } public async delete() { var request: Observable; @@ -69,7 +72,6 @@ export class RequestOptionsComponent { public async changeAvailability() { if (this.data.type === RequestType.movie) { - // TODO 4K await firstValueFrom(this.requestService.markMovieAvailable({id: this.data.id, is4K: false})) } if (this.data.type === RequestType.album) { diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts index e5bf34fa4..8117e0c22 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts @@ -12,8 +12,8 @@ export class RequestsListComponent { constructor(private bottomSheet: MatBottomSheet) { } - public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean, has4kRequest: boolean }) { - const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove, manageOwnRequests: event.manageOwnRequests, isAdmin: event.isAdmin, has4kRequest: event.has4kRequest } }); + public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean, has4kRequest: boolean, hasRegularRequest: boolean }) { + const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove, manageOwnRequests: event.manageOwnRequests, isAdmin: event.isAdmin, has4kRequest: event.has4kRequest, hasRegularRequest: event.hasRegularRequest } }); ref.afterDismissed().subscribe((result) => { if(!result) { diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts index 1d84fe3f0..25c552924 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.ts @@ -34,7 +34,7 @@ export class TvGridComponent implements OnInit, AfterViewInit { private storageKeyGridCount = "Tv_DefaultGridCount"; private storageKeyCurrentFilter = "Tv_DefaultFilter"; - @Output() public onOpenOptions = new EventEmitter<{request: any, filter: any, onChange: any}>(); + @Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean, has4kRequest: boolean, hasRegularRequest: boolean }>(); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; @@ -108,7 +108,7 @@ export class TvGridComponent implements OnInit, AfterViewInit { this.ref.detectChanges(); }; - const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: false }; + const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: false, hasRegularRequest: true }; this.onOpenOptions.emit(data); }