users can now remove their own requests

pull/2605/head
Anojh 6 years ago
parent 5e167e507d
commit 324c02a58d

@ -166,11 +166,7 @@
</button>
</div>
</div>
<form id="removeBtn">
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete">
<i class="fa fa-minus"></i> {{ 'Requests.Remove' | translate }}
</button>
</form>
<form id="markBtnGroup">
<button id="unavailableBtn" *ngIf="request.available" (click)="changeAvailability(request, false)" style="text-align: right"
@ -185,6 +181,13 @@
</div>
<div *ngIf="isAdmin || isRequestUser(request)">
<form id="removeBtn">
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete">
<i class="fa fa-minus"></i> {{ 'Requests.Remove' | translate }}
</button>
</form>
</div>
<div class="dropdown" *ngIf="issueCategories && issuesEnabled" id="issuesBtn">
<button class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"

@ -365,4 +365,11 @@ export class MovieRequestsComponent implements OnInit {
req.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + "https://image.tmdb.org/t/p/w1280" + req.background + ")");
}
public isRequestUser(request: IMovieRequests) {
if (request.requestedUser.userName === this.auth.claims().name) {
return true;
}
return false;
}
}

@ -169,11 +169,7 @@
</button>
</div>
</div>
<form id="removeBtn" class="col-md-6">
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete">
<i class="fa fa-minus"></i> {{ 'Requests.Remove' | translate }}
</button>
</form>
<form id="markBtnGroup">
<button id="unavailableBtn" *ngIf="request.available" (click)="changeAvailability(request, false)" style="text-align: right"
@ -188,6 +184,13 @@
</div>
<div *ngIf="isAdmin || isRequestUser(request)">
<form id="removeBtn" class="col-md-6">
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete">
<i class="fa fa-minus"></i> {{ 'Requests.Remove' | translate }}
</button>
</form>
</div>
<div class="dropdown" *ngIf="issueCategories && issuesEnabled" id="issuesBtn">
<button class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"

@ -348,4 +348,11 @@ export class MusicRequestsComponent implements OnInit {
req.background = this.sanitizer.bypassSecurityTrustStyle
("url(" + req.cover + ")");
}
public isRequestUser(request: IAlbumRequest) {
if (request.requestedUser.userName === this.auth.claims().name) {
return true;
}
return false;
}
}

@ -23,8 +23,10 @@
<button id="denyBtn" *ngIf="!child.denied" type="button" (click)="deny(child)" class="btn btn-sm btn-danger-outline deny"><i class="fa fa-times"></i> {{ 'Requests.Deny' | translate }}</button>
<button id="removeBtn" type="button" (click)="removeRequest(child)" class="btn btn-sm btn-danger-outline deny"><i class="fa fa-times"></i> {{ 'Requests.Remove' | translate }}</button>
</div>
<div *ngIf="isAdmin || isRequestUser(child)">
<button id="removeBtn" type="button" (click)="removeRequest(child)" class="btn btn-sm btn-danger-outline deny"><i class="fa fa-times"></i> {{ 'Requests.Remove' | translate }}</button>
</div>
</div>

@ -10,6 +10,7 @@ import { NotificationService, RequestService } from "../services";
export class TvRequestChildrenComponent {
@Input() public childRequests: IChildRequests[];
@Input() public isAdmin: boolean;
@Input() public currentUser: string;
@Output() public requestDeleted = new EventEmitter<number>();
@ -116,4 +117,11 @@ export class TvRequestChildrenComponent {
this.childRequests.splice(index, 1);
}
}
public isRequestUser(request: IChildRequests) {
if (request.requestedUser.userName === this.currentUser) {
return true;
}
return false;
}
}

@ -99,7 +99,7 @@
</div>
<!--This is the section that holds the child seasons if they want to specify specific episodes-->
<div *ngIf="node.open">
<tvrequests-children [childRequests]="node.childRequests" [isAdmin]="isAdmin" (requestDeleted)="childRequestDeleted($event)"></tvrequests-children>
<tvrequests-children [childRequests]="node.childRequests" [isAdmin]="isAdmin" [currentUser]="currentUser" (requestDeleted)="childRequestDeleted($event)"></tvrequests-children>
</div>
<br/>

@ -20,6 +20,7 @@ export class TvRequestsComponent implements OnInit {
public searchChanged = new Subject<string>();
public searchText: string;
public isAdmin: boolean;
public currentUser: string;
public showChildDialogue = false; // This is for the child modal popup
public selectedSeason: ITvRequests;
public defaultPoster: string;
@ -48,6 +49,7 @@ export class TvRequestsComponent implements OnInit {
private readonly platformLocation: PlatformLocation) {
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
this.currentUser = this.auth.claims().name;
if (this.isAdmin) {
this.sonarrService.getQualityProfilesWithoutSettings()
.subscribe(x => this.sonarrProfiles = x);

Loading…
Cancel
Save