fix(requests): 🐛 Fixed the approve 4k option on the requests list not working as expected

pull/4511/head
tidusjar 3 years ago
parent 87cb9903db
commit c0189dad47

@ -22,6 +22,7 @@ export interface IMovieRequests extends IFullBaseRequest {
denied4K: boolean;
deniedReason4K: string;
requestedDate4k: Date;
requestedDate: Date;
// For the UI
rootPathOverrideTitle: string;

@ -142,10 +142,20 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
this.ref.detectChanges();
};
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: request.has4KRequest };
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin, has4kRequest: request.has4KRequest, hasRegularRequest: this.checkDate(request.requestedDate) };
this.onOpenOptions.emit(data);
}
private checkDate(date: Date|string): boolean {
if (date instanceof String) {
return new Date(date).getFullYear() > 1;
}
if (date instanceof Date) {
return date.getFullYear() > 1;
}
return false;
}
public switchFilter(type: RequestFilterType) {
this.currentFilter = type;
this.ngAfterViewInit();

@ -2,10 +2,10 @@
<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.isAdmin" (click)="approve()" mat-list-item>
<a id="requestApprove" *ngIf="data.canApprove && data.hasRegularRequest && data.isAdmin" (click)="approve()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.Approve' | translate}}</span>
</a>
<a id="requestApprove4k" *ngIf="data.canApprove && data.isAdmin && data.has4kRequest" (click)="approve4k()" mat-list-item>
<a id="requestApprove4k" *ngIf="data.canApprove && data.isAdmin && data.has4kRequest ?? false" (click)="approve4K()" mat-list-item>
<span mat-line>{{'Requests.RequestPanel.Approve4K' | translate}}</span>
</a>
<a id="requestChangeAvailability" *ngIf="data.type !== RequestType.tvShow && data.isAdmin" (click)="changeAvailability()" mat-list-item>

@ -63,6 +63,8 @@ export class RequestOptionsComponent {
}
await firstValueFrom(this.requestService.approveMovie({id: this.data.id, is4K: true}));
this.bottomSheetRef.dismiss({type: UpdateType.Approve});
return;
}
public async changeAvailability() {

Loading…
Cancel
Save