Fixed the report issue button appearing when issues were not enabled

pull/4069/head v4.0.1119
tidusjar 4 years ago
parent c0149a6149
commit 094e1ce69f

@ -10,7 +10,6 @@ import { SettingsService } from "./services";
import { MatSnackBar } from '@angular/material/snack-bar';
import { ICustomizationSettings, ICustomPage } from "./interfaces";
import { StorageService } from './shared/storage/storage-service';
import { SignalRNotificationService } from './services/signlarnotification.service';
import { DOCUMENT } from '@angular/common';
@ -46,7 +45,6 @@ export class AppComponent implements OnInit {
public readonly translate: TranslateService,
private readonly customPageService: CustomPageService,
public overlayContainer: OverlayContainer,
private storage: StorageService,
private signalrNotification: SignalRNotificationService,
private readonly snackBar: MatSnackBar,
private readonly identity: IdentityService,

@ -91,7 +91,7 @@
</button>
</span>
<button mat-raised-button class="btn-spacing" color="danger" (click)="issue()">
<button mat-raised-button class="btn-spacing" color="danger" (click)="issue()" *ngIf="issuesEnabled">
<i class="fas fa-exclamation"></i> {{'Requests.ReportIssue' | translate }}
</button>
<button *ngIf="movie.belongsToCollection" [routerLink]="'/discover/collection/' + movie.belongsToCollection.id" mat-raised-button class="btn-spacing">

@ -1,5 +1,5 @@
import { AfterViewInit, Component, ViewChild, ViewEncapsulation } from "@angular/core";
import { ImageService, SearchV2Service, RequestService, MessageService, RadarrService } from "../../../services";
import { ImageService, SearchV2Service, RequestService, MessageService, RadarrService, SettingsStateService } from "../../../services";
import { ActivatedRoute } from "@angular/router";
import { DomSanitizer } from "@angular/platform-browser";
import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2";
@ -26,6 +26,7 @@ export class MovieDetailsComponent {
public isAdmin: boolean;
public advancedOptions: IAdvancedData;
public showAdvanced: boolean; // Set on the UI
public issuesEnabled: boolean;
public requestType = RequestType.movie;
@ -37,7 +38,7 @@ export class MovieDetailsComponent {
private sanitizer: DomSanitizer, private imageService: ImageService,
public dialog: MatDialog, private requestService: RequestService,
private requestService2: RequestServiceV2, private radarrService: RadarrService,
public messageService: MessageService, private auth: AuthService) {
public messageService: MessageService, private auth: AuthService, private settingsState: SettingsStateService) {
this.route.params.subscribe(async (params: any) => {
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
if (params.movieDbId.startsWith("tt")) {
@ -51,6 +52,7 @@ export class MovieDetailsComponent {
public async load() {
this.issuesEnabled = this.settingsState.getIssue();
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
if (this.isAdmin) {

@ -57,7 +57,7 @@
class="btn-spacing" color="accent" [disabled]>
<i class="fas fa-check"></i> {{'Common.PartiallyAvailable' | translate }}</button>
<button mat-raised-button class="btn-spacing" color="danger" (click)="issue()">
<button mat-raised-button class="btn-spacing" color="danger" *ngIf="issuesEnabled" (click)="issue()">
<i class="fas fa-exclamation"></i> {{
'Requests.ReportIssue' | translate }}</button>

@ -1,5 +1,5 @@
import { Component, ViewEncapsulation, OnInit } from "@angular/core";
import { ImageService, SearchV2Service, MessageService, RequestService, SonarrService } from "../../../services";
import { ImageService, SearchV2Service, MessageService, RequestService, SonarrService, SettingsStateService } from "../../../services";
import { ActivatedRoute } from "@angular/router";
import { DomSanitizer } from "@angular/platform-browser";
import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2";
@ -29,6 +29,7 @@ export class TvDetailsComponent implements OnInit {
public advancedOptions: IAdvancedData;
public showAdvanced: boolean; // Set on the UI
public requestType = RequestType.tvShow;
public issuesEnabled: boolean;
private tvdbId: number;
@ -36,7 +37,7 @@ export class TvDetailsComponent implements OnInit {
private sanitizer: DomSanitizer, private imageService: ImageService,
public dialog: MatDialog, public messageService: MessageService, private requestService: RequestService,
private requestService2: RequestServiceV2,
private auth: AuthService, private sonarrService: SonarrService) {
private auth: AuthService, private sonarrService: SonarrService, private settingsState: SettingsStateService) {
this.route.params.subscribe((params: any) => {
this.tvdbId = params.tvdbId;
this.fromSearch = params.search;
@ -49,6 +50,7 @@ export class TvDetailsComponent implements OnInit {
public async load() {
this.issuesEnabled = this.settingsState.getIssue();
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
if (this.isAdmin) {

@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { INavBar } from '../interfaces/ICommon';
import { StorageService } from '../shared/storage/storage-service';
import { SettingsService } from '../services';
import { SettingsService, SettingsStateService } from '../services';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { SearchFilter } from './SearchFilter';
import { Md5 } from 'ts-md5/dist/md5';
@ -49,7 +49,8 @@ export class MyNavComponent implements OnInit {
constructor(private breakpointObserver: BreakpointObserver,
private settingsService: SettingsService,
private store: StorageService,
private filterService: FilterService) {
private filterService: FilterService,
private readonly settingState: SettingsStateService) {
}
public async ngOnInit() {
@ -68,6 +69,8 @@ export class MyNavComponent implements OnInit {
}
this.issuesEnabled = await this.settingsService.issueEnabled().toPromise();
this.settingState.setIssue(this.issuesEnabled);
const customizationSettings = await this.settingsService.getCustomization().toPromise();
console.log("issues enabled: " + this.issuesEnabled);
this.theme = this.store.get("theme");

@ -22,3 +22,4 @@ export * from "./message.service";
export * from "./hub.service";
export * from "./system.service";
export * from "./filedownload.service";
export * from "./settingsState.service";

@ -0,0 +1,17 @@
import { Injectable } from "@angular/core";
@Injectable({
providedIn: 'root',
})
export class SettingsStateService {
private issuesEnabled: boolean;
public getIssue(): boolean {
return this.issuesEnabled;
}
public setIssue(settings: boolean): void {
this.issuesEnabled = settings;
}
}
Loading…
Cancel
Save