Skip to content

Commit 9be8a87

Browse files
author
Andrea Barbasso
committed
[DURACOM-309] fix pipeline, remove cookie settings link from footer if popup is disabled
1 parent 887bf0d commit 9be8a87

8 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/app/footer/footer.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ <h5 class="text-uppercase">Footer Content</h5>
5959
href="https://www.lyrasis.org/" role="link" tabindex="0">{{ 'footer.link.lyrasis' | translate}}</a>
6060
</p>
6161
<ul class="footer-info list-unstyled d-flex justify-content-center mb-0">
62+
@if (showCookieSettings) {
6263
<li>
63-
<button class="btn btn-link text-white" type="button" (click)="showCookieSettings()" role="button" tabindex="0">
64+
<button class="btn btn-link text-white" type="button" (click)="openCookieSettings()" role="button" tabindex="0">
6465
{{ 'footer.link.cookies' | translate}}
6566
</button>
6667
</li>
68+
}
6769
@if (showPrivacyPolicy) {
6870
<li>
6971
<a class="btn text-white"

src/app/footer/footer.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ describe('Footer component', () => {
6363
expect(comp.showEndUserAgreement).toBe(environment.info.enableEndUserAgreement);
6464
});
6565

66-
describe('showCookieSettings', () => {
66+
describe('openCookieSettings', () => {
6767
it('should call cookies.showSettings() if cookies is defined', () => {
6868
const cookies = jasmine.createSpyObj('cookies', ['showSettings']);
6969
comp.cookies = cookies;
70-
comp.showCookieSettings();
70+
comp.openCookieSettings();
7171
expect(cookies.showSettings).toHaveBeenCalled();
7272
});
7373

7474
it('should not call cookies.showSettings() if cookies is undefined', () => {
7575
comp.cookies = undefined;
76-
expect(() => comp.showCookieSettings()).not.toThrow();
76+
expect(() => comp.openCookieSettings()).not.toThrow();
7777
});
7878

7979
it('should return false', () => {
80-
expect(comp.showCookieSettings()).toBeFalse();
80+
expect(comp.openCookieSettings()).toBeFalse();
8181
});
8282
});
8383

src/app/footer/footer.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class FooterComponent implements OnInit {
3939
* A boolean representing if to show or not the top footer container
4040
*/
4141
showTopFooter = false;
42+
showCookieSettings = false;
4243
showPrivacyPolicy: boolean;
4344
showEndUserAgreement: boolean;
4445
showSendFeedback$: Observable<boolean>;
@@ -53,13 +54,14 @@ export class FooterComponent implements OnInit {
5354
}
5455

5556
ngOnInit(): void {
57+
this.showCookieSettings = this.appConfig.info.enableCookieConsentPopup;
5658
this.showPrivacyPolicy = this.appConfig.info.enablePrivacyStatement;
5759
this.showEndUserAgreement = this.appConfig.info.enableEndUserAgreement;
5860
this.coarLdnEnabled$ = this.appConfig.info.enableCOARNotifySupport ? this.notifyInfoService.isCoarConfigEnabled() : observableOf(false);
5961
this.showSendFeedback$ = this.authorizationService.isAuthorized(FeatureID.CanSendFeedback);
6062
}
6163

62-
showCookieSettings() {
64+
openCookieSettings() {
6365
if (hasValue(this.cookies)) {
6466
this.cookies.showSettings();
6567
}

src/app/shared/cookies/browser-orejime.service.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import cloneDeep from 'lodash/cloneDeep';
66
import { of as observableOf } from 'rxjs';
77
import { TestScheduler } from 'rxjs/testing';
88

9+
import { environment } from '../../../environments/environment';
910
import { AuthService } from '../../core/auth/auth.service';
1011
import { RestResponse } from '../../core/cache/response.models';
1112
import { ConfigurationDataService } from '../../core/data/configuration-data.service';
@@ -78,6 +79,8 @@ describe('BrowserOrejimeService', () => {
7879
},
7980
});
8081

82+
environment.info.enableCookieConsentPopup = true;
83+
8184
TestBed.configureTestingModule({
8285
providers: [
8386
BrowserOrejimeService,

src/config/default-app-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ export class DefaultAppConfig implements AppConfig {
483483
enableEndUserAgreement: true,
484484
enablePrivacyStatement: true,
485485
enableCOARNotifySupport: true,
486+
enableCookieConsentPopup: true,
486487
};
487488

488489
// Whether to enable Markdown (https://commonmark.org/) and MathJax (https://www.mathjax.org/)

src/environments/environment.production.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ export const environment: Partial<BuildConfig> = {
1414
enableSearchComponent: false,
1515
enableBrowseComponent: false,
1616
},
17-
info: {
18-
enableCookieConsentPopup: true,
19-
},
2017
};

src/environments/environment.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ export const environment: BuildConfig = {
324324
enableEndUserAgreement: true,
325325
enablePrivacyStatement: true,
326326
enableCOARNotifySupport: true,
327-
enableCookieConsentPopup: true,
328327
},
329328
markdown: {
330329
enabled: false,

src/environments/environment.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ export const environment: Partial<BuildConfig> = {
1919
enableSearchComponent: false,
2020
enableBrowseComponent: false,
2121
},
22-
info: {
23-
enableCookieConsentPopup: true,
24-
},
2522
};
2623

2724
/*

0 commit comments

Comments
 (0)