Skip to content

Commit

Permalink
Merge pull request DSpace#2326 from 4Science/DURACOM-160
Browse files Browse the repository at this point in the history
[DURACOM-160] Hide "Send feedback" link when CanSendFeedback is false
  • Loading branch information
tdonohue committed Jun 20, 2023
2 parents 2fa8ab5 + 4eb2297 commit 8348932
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h5 class="text-uppercase">Footer Content</h5>
<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>
Expand Down
5 changes: 4 additions & 1 deletion src/app/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand All @@ -34,7 +36,8 @@ describe('Footer component', () => {
})],
declarations: [FooterComponent], // declare the test component
providers: [
FooterComponent
FooterComponent,
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
Expand Down
10 changes: 9 additions & 1 deletion src/app/footer/footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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() {
Expand Down

0 comments on commit 8348932

Please sign in to comment.