fix(requests): 🐛 Fixed the issue where we could no longer approve TV Requests from the requests list

pull/4532/head
tidusjar 2 years ago
parent 68600f3b45
commit 19fe4e342e

@ -24,6 +24,6 @@ namespace Ombi.Store.Entities.Requests
[NotMapped]
public bool CanApprove => !Approved && !Available;
public virtual bool CanApprove => !Approved && !Available;
}
}

@ -81,5 +81,8 @@ namespace Ombi.Store.Entities.Requests
return string.Empty;
}
}
[NotMapped]
public override bool CanApprove => !Approved && !Available || !Approved4K && !Available4K;
}
}

@ -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;

@ -2,7 +2,7 @@
<a id="requestDelete" *ngIf="data.isAdmin || data.manageOwnRequests" (click)="delete()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.Delete' | translate}}</span>
</a>
<a id="requestApprove" *ngIf="data.canApprove && data.hasRegularRequest && data.isAdmin" (click)="approve()" mat-list-item>
<a id="requestApprove" *ngIf="data.canApprove && data.isAdmin && data.hasRegularRequest" (click)="approve()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.Approve' | translate}}</span>
</a>
<a id="requestApprove4k" *ngIf="data.canApprove && data.isAdmin && data.has4kRequest ?? false" (click)="approve4K()" mat-list-item>

@ -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<RequestOptionsComponent>,
private translate: TranslateService) { }
ngOnInit(): void {
console.log(this.data);
}
public async delete() {
var request: Observable<IRequestEngineResult>;
@ -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) {

@ -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) {

@ -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);
}

Loading…
Cancel
Save