Skip to content

Commit

Permalink
fix(request-list): 🐛 Fixed an issue where the request options were no…
Browse files Browse the repository at this point in the history
…t appearing for Music requests
  • Loading branch information
tidusjar committed Nov 6, 2021
1 parent acc66fa commit c0406a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -117,16 +119,17 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {

public openOptions(request: IAlbumRequest) {
const filter = () => {
this.dataSource = this.dataSource.filter((req) => {
return req.id !== request.id;
})
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) {
Expand Down
1 change: 1 addition & 0 deletions src/Ombi/ClientApp/src/app/services/request.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
Expand Down

1 comment on commit c0406a2

@tidusjar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.