mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Added back the ability for users with ManageOwnRequests role to manage their requests! #4203
This commit is contained in:
parent
72ffe0236a
commit
7a85f8ab7c
8 changed files with 32 additions and 24 deletions
|
@ -69,10 +69,11 @@
|
|||
<button *ngIf="!request.available" mat-raised-button color="warn" (click)="changeAvailability(request, true);">{{ 'Requests.MarkAvailable' | translate }}</button>
|
||||
<button *ngIf="request.available" mat-raised-button color="warn" (click)="changeAvailability(request, false);">{{ 'Requests.MarkUnavailable' | translate }}</button>
|
||||
<button *ngIf="!request.denied" mat-raised-button color="danger" (click)="deny(request);">{{ 'Requests.Deny' | translate }}</button>
|
||||
<button mat-raised-button color="danger" (click)="delete(request);">{{ 'Requests.RequestPanel.Delete' | translate }}</button>
|
||||
<button mat-raised-button color="accent" (click)="reProcessRequest(request);">{{ 'MediaDetails.ReProcessRequest' | translate }}</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="isAdmin || manageOwnRequests">
|
||||
<button mat-raised-button color="danger" (click)="delete(request);">{{ 'Requests.RequestPanel.Delete' | translate }}</button>
|
||||
</div>
|
||||
|
||||
|
||||
</mat-expansion-panel>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { Component, Input } from "@angular/core";
|
||||
import { IChildRequests, RequestType } from "../../../../../interfaces";
|
||||
import { RequestService } from "../../../../../services/request.service";
|
||||
import { MessageService } from "../../../../../services";
|
||||
import { MatDialog } from "@angular/material/dialog";
|
||||
|
||||
import { DenyDialogComponent } from "../../../shared/deny-dialog/deny-dialog.component";
|
||||
import { MatDialog } from "@angular/material/dialog";
|
||||
import { MessageService } from "../../../../../services";
|
||||
import { RequestService } from "../../../../../services/request.service";
|
||||
import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
||||
|
||||
@Component({
|
||||
|
@ -14,6 +15,7 @@ import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
|||
export class TvRequestsPanelComponent {
|
||||
@Input() public tvRequest: IChildRequests[];
|
||||
@Input() public isAdmin: boolean;
|
||||
@Input() public manageOwnRequests: boolean;
|
||||
|
||||
public displayedColumns: string[] = ['number', 'title', 'airDate', 'status'];
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
{{'Requests.Title' | translate}}
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<tv-requests-panel [tvRequest]="tvRequest" [isAdmin]="isAdmin"></tv-requests-panel>
|
||||
<tv-requests-panel [tvRequest]="tvRequest" [isAdmin]="isAdmin" [manageOwnRequests]="manageOwnRequests"></tv-requests-panel>
|
||||
</mat-expansion-panel>
|
||||
|
||||
</mat-accordion>
|
||||
|
|
|
@ -27,6 +27,7 @@ export class TvDetailsComponent implements OnInit {
|
|||
public showRequest: ITvRequests;
|
||||
public fromSearch: boolean;
|
||||
public isAdmin: boolean;
|
||||
public manageOwnRequests: boolean;
|
||||
public advancedOptions: IAdvancedData;
|
||||
public showAdvanced: boolean; // Set on the UI
|
||||
public requestType = RequestType.tvShow;
|
||||
|
@ -53,6 +54,7 @@ export class TvDetailsComponent implements OnInit {
|
|||
|
||||
this.issuesEnabled = this.settingsState.getIssue();
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
this.manageOwnRequests = this.auth.hasRole('ManageOwnRequests');
|
||||
|
||||
if (this.isAdmin) {
|
||||
this.showAdvanced = await this.sonarrService.isEnabled();
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<th mat-header-cell *matHeaderCellDef> </th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button id="detailsButton{{element.id}}" mat-raised-button color="accent" [routerLink]="'/details/movie/' + element.theMovieDbId">{{ 'Requests.Details' | translate}}</button>
|
||||
<button id="optionsButton{{element.id}}" mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin"> {{ 'Requests.Options' | translate}}</button>
|
||||
<button id="optionsButton{{element.id}}" mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin || manageOwnRequests"> {{ 'Requests.Options' | translate}}</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import { Component, AfterViewInit, ViewChild, EventEmitter, Output, ChangeDetectorRef, OnInit } from "@angular/core";
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, EventEmitter, OnInit, Output, ViewChild } from "@angular/core";
|
||||
import { IMovieRequests, IRequestEngineResult, IRequestsViewModel } from "../../../interfaces";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatSort } from "@angular/material/sort";
|
||||
import { merge, Observable, of as observableOf, forkJoin } from 'rxjs';
|
||||
import { NotificationService, RequestService } from "../../../services";
|
||||
import { Observable, forkJoin, merge, of as observableOf } from 'rxjs';
|
||||
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
|
||||
|
||||
import { RequestServiceV2 } from "../../../services/requestV2.service";
|
||||
import { AuthService } from "../../../auth/auth.service";
|
||||
import { StorageService } from "../../../shared/storage/storage-service";
|
||||
import { RequestFilterType } from "../../models/RequestFilterType";
|
||||
import { SelectionModel } from "@angular/cdk/collections";
|
||||
import { NotificationService, RequestService } from "../../../services";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatSort } from "@angular/material/sort";
|
||||
import { MatTableDataSource } from "@angular/material/table";
|
||||
import { RequestFilterType } from "../../models/RequestFilterType";
|
||||
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";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./movies-grid.component.html",
|
||||
|
@ -26,6 +26,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
public displayedColumns: string[] = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate', 'actions'];
|
||||
public gridCount: string = "15";
|
||||
public isAdmin: boolean;
|
||||
public manageOwnRequests: boolean;
|
||||
public defaultSort: string = "requestedDate";
|
||||
public defaultOrder: string = "desc";
|
||||
public currentFilter: RequestFilterType = RequestFilterType.All;
|
||||
|
@ -39,7 +40,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 }>();
|
||||
@Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean }>();
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
@ -53,6 +54,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
|
||||
public ngOnInit() {
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
this.manageOwnRequests = this.auth.hasRole("ManageOwnRequests")
|
||||
if (this.isAdmin) {
|
||||
this.displayedColumns.unshift('select');
|
||||
}
|
||||
|
@ -135,7 +137,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
this.ref.detectChanges();
|
||||
};
|
||||
|
||||
this.onOpenOptions.emit({ request: request, filter: filter, onChange: onChange });
|
||||
this.onOpenOptions.emit({ request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin });
|
||||
}
|
||||
|
||||
public switchFilter(type: RequestFilterType) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<mat-nav-list>
|
||||
<a id="requestDelete" (click)="delete()" mat-list-item>
|
||||
<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" (click)="approve()" mat-list-item>
|
||||
<a id="requestApprove" *ngIf="data.canApprove && data.isAdmin" (click)="approve()" mat-list-item>
|
||||
<span mat-line>{{'Requests.RequestPanel.Approve' | translate}}</span>
|
||||
</a>
|
||||
<a id="requestChangeAvailability" *ngIf="data.type !== RequestType.tvShow" (click)="changeAvailability()" mat-list-item>
|
||||
<a id="requestChangeAvailability" *ngIf="data.type !== RequestType.tvShow && data.isAdmin" (click)="changeAvailability()" mat-list-item>
|
||||
<span mat-line>{{'Requests.RequestPanel.ChangeAvailability' | translate}}</span>
|
||||
</a>
|
||||
</mat-nav-list>
|
|
@ -1,8 +1,9 @@
|
|||
import { Component, ViewChild } from "@angular/core";
|
||||
|
||||
import { MatBottomSheet } from "@angular/material/bottom-sheet";
|
||||
import { MoviesGridComponent } from "./movies-grid/movies-grid.component";
|
||||
import { RequestOptionsComponent } from "./options/request-options.component";
|
||||
import { UpdateType } from "../models/UpdateType";
|
||||
import { MoviesGridComponent } from "./movies-grid/movies-grid.component";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./requests-list.component.html",
|
||||
|
@ -12,7 +13,7 @@ export class RequestsListComponent {
|
|||
|
||||
constructor(private bottomSheet: MatBottomSheet) { }
|
||||
|
||||
public onOpenOptions(event: { request: any, filter: any, onChange: any }) {
|
||||
public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean }) {
|
||||
const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove } });
|
||||
|
||||
ref.afterDismissed().subscribe((result) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue