[DURACOM-160] Hide "Send feedback" link when CanSendFeedback is false

This commit is contained in:
Davide Negretti
2023-06-19 13:24:10 +02:00
parent 471051dd59
commit 4eb2297910
3 changed files with 14 additions and 3 deletions

View File

@@ -75,7 +75,7 @@
<a class="text-white"
routerLink="info/end-user-agreement">{{ 'footer.link.end-user-agreement' | translate}}</a>
</li>
<li>
<li *ngIf="showSendFeedback$ | async">
<a class="text-white"
routerLink="info/feedback">{{ 'footer.link.feedback' | translate}}</a>
</li>

View File

@@ -15,6 +15,8 @@ import { FooterComponent } from './footer.component';
import { TranslateLoaderMock } from '../shared/mocks/translate-loader.mock';
import { storeModuleConfig } from '../app.reducer';
import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service';
import { AuthorizationDataServiceStub } from '../shared/testing/authorization-service.stub';
let comp: FooterComponent;
let fixture: ComponentFixture<FooterComponent>;
@@ -34,7 +36,8 @@ describe('Footer component', () => {
})],
declarations: [FooterComponent], // declare the test component
providers: [
FooterComponent
FooterComponent,
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});

View File

@@ -2,6 +2,9 @@ import { Component, Optional } from '@angular/core';
import { hasValue } from '../shared/empty.util';
import { KlaroService } from '../shared/cookies/klaro.service';
import { environment } from '../../environments/environment';
import { Observable } from 'rxjs';
import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service';
import { FeatureID } from '../core/data/feature-authorization/feature-id';
@Component({
selector: 'ds-footer',
@@ -17,8 +20,13 @@ export class FooterComponent {
showTopFooter = false;
showPrivacyPolicy = environment.info.enablePrivacyStatement;
showEndUserAgreement = environment.info.enableEndUserAgreement;
showSendFeedback$: Observable<boolean>;
constructor(@Optional() private cookies: KlaroService) {
constructor(
@Optional() private cookies: KlaroService,
private authorizationService: AuthorizationDataService,
) {
this.showSendFeedback$ = this.authorizationService.isAuthorized(FeatureID.CanSendFeedback);
}
showCookieSettings() {