diff --git a/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.spec.ts b/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.spec.ts index 1c8cb4b2d41b..4b97e2652abb 100644 --- a/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.spec.ts +++ b/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.spec.ts @@ -96,7 +96,7 @@ describe('DotPropertiesService', () => { const apiResponse = { entity: { [FeaturedFlags.DOTFAVORITEPAGE_FEATURE_ENABLE]: 'true', - [FeaturedFlags.FEATURE_FLAG_EDIT_URL_CONTENT_MAP]: 'NOT_FOUND' + [FeaturedFlags.FEATURE_FLAG_EDIT_URL_CONTENT_MAP]: FEATURE_FLAG_NOT_FOUND } }; @@ -112,6 +112,23 @@ describe('DotPropertiesService', () => { req.flush(apiResponse); }); + it('should get feature flag value as true when not found', (done) => { + const featureFlag = FeaturedFlags.FEATURE_FLAG_ANNOUNCEMENTS; + const apiResponse = { + entity: { + [FeaturedFlags.FEATURE_FLAG_ANNOUNCEMENTS]: 'NOT_FOUND' + } + }; + + service.getFeatureFlag(featureFlag).subscribe((response) => { + expect(response).toEqual(true); + done(); + }); + const req = httpMock.expectOne(`/api/v1/configuration/config?keys=${featureFlag}`); + expect(req.request.method).toBe('GET'); + req.flush(apiResponse); + }); + afterEach(() => { httpMock.verify(); }); diff --git a/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts b/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts index ede8e4f202b2..b907676f7769 100644 --- a/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts +++ b/core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts @@ -5,7 +5,7 @@ import { Injectable } from '@angular/core'; import { map, pluck, take } from 'rxjs/operators'; -import { FeaturedFlags } from '@dotcms/dotcms-models'; +import { FEATURE_FLAG_NOT_FOUND, FeaturedFlags } from '@dotcms/dotcms-models'; @Injectable({ providedIn: 'root' @@ -57,13 +57,14 @@ export class DotPropertiesService { /** * Get the value of specific feature flag - * * @param {FeaturedFlags} key * @return {*} {Observable} * @memberof DotPropertiesService */ getFeatureFlag(key: FeaturedFlags): Observable { - return this.getKey(key).pipe(map((value) => value === 'true')); + return this.getKey(key).pipe( + map((value) => (value === FEATURE_FLAG_NOT_FOUND ? true : value === 'true')) + ); } /** diff --git a/dotcms-integration/src/test/resources/dotmarketing-config.properties b/dotcms-integration/src/test/resources/dotmarketing-config.properties index 443105863e84..fe4035711f7a 100644 --- a/dotcms-integration/src/test/resources/dotmarketing-config.properties +++ b/dotcms-integration/src/test/resources/dotmarketing-config.properties @@ -879,3 +879,7 @@ DELETE_CONTENT_TYPE_ASYNC=true DELETE_CONTENT_TYPE_ASYNC_WITH_JOB=false secrets.scripting.enabled=true + +#Feature Flags for the new Edit Page and Content Editor +FEATURE_FLAG_NEW_EDIT_PAGE=false +CONTENT_EDITOR2_ENABLED=false