mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-6782] Hide cookie settings when verification is disabled
This commit is contained in:
@@ -81,24 +81,31 @@ export class BrowserKlaroService extends KlaroService {
|
|||||||
this.klaroConfig.translations.en.consentNotice.description = 'cookies.consent.content-notice.description.no-privacy';
|
this.klaroConfig.translations.en.consentNotice.description = 'cookies.consent.content-notice.description.no-privacy';
|
||||||
}
|
}
|
||||||
|
|
||||||
const servicesToHide$: Observable<string[]> = this.configService.findByPropertyName(this.GOOGLE_ANALYTICS_KEY).pipe(
|
const hideGoogleAnalytics$ = this.configService.findByPropertyName(this.GOOGLE_ANALYTICS_KEY).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
map(remoteData => {
|
map(remoteData => !remoteData.hasSucceeded || !remoteData.payload || isEmpty(remoteData.payload.values)),
|
||||||
if (!remoteData.hasSucceeded || !remoteData.payload || isEmpty(remoteData.payload.values)) {
|
|
||||||
return [this.GOOGLE_ANALYTICS_SERVICE_NAME];
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.configService.findByPropertyName(this.REGISTRATION_VERIFICATION_ENABLED_KEY).pipe(
|
const hideRegistrationVerification$ = this.configService.findByPropertyName(this.REGISTRATION_VERIFICATION_ENABLED_KEY).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe((remoteData) => {
|
map((remoteData) =>
|
||||||
if (remoteData.statusCode === 404 || isEmpty(remoteData.payload?.values) || remoteData.payload.values[0].toLowerCase() !== 'true') {
|
!remoteData.hasSucceeded || !remoteData.payload || isEmpty(remoteData.payload.values) || remoteData.payload.values[0].toLowerCase() !== 'true'
|
||||||
this.klaroConfig.services = klaroConfiguration.services.filter(config => config.name !== CAPTCHA_NAME);
|
),
|
||||||
}
|
);
|
||||||
});
|
|
||||||
|
const servicesToHide$: Observable<string[]> = observableCombineLatest([hideGoogleAnalytics$, hideRegistrationVerification$]).pipe(
|
||||||
|
map(([hideGoogleAnalytics, hideRegistrationVerification]) => {
|
||||||
|
let servicesToHideArray: string[] = [];
|
||||||
|
if (hideGoogleAnalytics) {
|
||||||
|
servicesToHideArray.push(this.GOOGLE_ANALYTICS_SERVICE_NAME);
|
||||||
|
}
|
||||||
|
if (hideRegistrationVerification) {
|
||||||
|
servicesToHideArray.push(CAPTCHA_NAME);
|
||||||
|
}
|
||||||
|
console.log(servicesToHideArray);
|
||||||
|
return servicesToHideArray;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
this.translateService.setDefaultLang(environment.defaultLanguage);
|
this.translateService.setDefaultLang(environment.defaultLanguage);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user