fix(request-list): 🐛 Fixed an issue where the request options were not appearing for Music requests

pull/4384/head
tidusjar 3 years ago
parent acc66fad49
commit c0406a2dde

@ -60,7 +60,7 @@
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let element">
<button mat-raised-button color="accent" [routerLink]="'/details/artist/' + element.foreignArtistId">{{ 'Requests.Details' | translate}}</button>
<button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin"> {{ 'Requests.Options' | translate}}</button>
<button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin || manageOwnRequests"> {{ 'Requests.Options' | translate}}</button>
</td>
</ng-container>

@ -25,6 +25,7 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {
public defaultSort: string = "requestedDate";
public defaultOrder: string = "desc";
public currentFilter: RequestFilterType = RequestFilterType.All;
public manageOwnRequests: boolean;
public RequestFilter = RequestFilterType;
@ -46,6 +47,7 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {
public ngOnInit() {
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
this.manageOwnRequests = this.auth.hasRole("ManageOwnRequests")
const defaultCount = this.storageService.get(this.storageKeyGridCount);
const defaultSort = this.storageService.get(this.storageKey);
@ -119,14 +121,15 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {
const filter = () => {
this.dataSource = this.dataSource.filter((req) => {
return req.id !== request.id;
})
});
};
const onChange = () => {
this.ref.detectChanges();
};
this.onOpenOptions.emit({ request: request, filter: filter, onChange: onChange });
const data = { request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin };
this.onOpenOptions.emit(data);
}
public switchFilter(type: RequestFilterType) {

@ -128,6 +128,7 @@ export class RequestService extends ServiceHelpers {
public approveChild(child: ITvUpdateModel): Observable<IRequestEngineResult> {
return this.http.post<IRequestEngineResult>(`${this.url}tv/approve`, JSON.stringify(child), {headers: this.headers});
}
public deleteChild(childId: number): Observable<boolean> {
return this.http.delete<boolean>(`${this.url}tv/child/${childId}`, {headers: this.headers});
}

Loading…
Cancel
Save