From 33264f07315f329b56c81ce5c6a2c47c0f1ed83c Mon Sep 17 00:00:00 2001 From: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:52:17 +0100 Subject: [PATCH] [ACS-6924] Rename tags and categories plugins to mitigate naming conflicts (#3687) * [ACS-6924] Rename tags and categories plugins to mitigate conflicts * [ACS-6924] Add missing logic for tags and categories plugins --- app/src/app.config.json | 4 ++-- docker/docker-entrypoint.d/30-sed-on-appconfig.sh | 10 ++++++++++ projects/aca-shared/rules/src/app.rules.spec.ts | 4 ++-- projects/aca-shared/rules/src/app.rules.ts | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/app.config.json b/app/src/app.config.json index d865a996c..4654d5278 100644 --- a/app/src/app.config.json +++ b/app/src/app.config.json @@ -13,8 +13,8 @@ "aosPlugin": true, "contentService": true, "folderRules": true, - "tags": true, - "categories": true + "tagsEnabled": true, + "categoriesEnabled": true }, "oauth2": { "host": "{protocol}//{hostname}{:port}/auth/realms/alfresco", diff --git a/docker/docker-entrypoint.d/30-sed-on-appconfig.sh b/docker/docker-entrypoint.d/30-sed-on-appconfig.sh index 603719d4c..c7682ff8b 100755 --- a/docker/docker-entrypoint.d/30-sed-on-appconfig.sh +++ b/docker/docker-entrypoint.d/30-sed-on-appconfig.sh @@ -117,3 +117,13 @@ if [ -n "${APP_BASE_SHARE_URL}" ]; then sed -e "s/\"baseShareUrl\": \".*\"/\"baseShareUrl\": \"${encoded}\"/g" \ -i "$APP_CONFIG_FILE" fi + +if [ -n "${APP_CONFIG_PLUGIN_TAGS}" ]; then + echo "SET APP_CONFIG_PLUGIN_TAGS" + sed -e "s/\"tagsEnabled\": [^,]*/\"tagsEnabled\": ${APP_CONFIG_PLUGIN_TAGS}/g" -i "$APP_CONFIG_FILE" +fi + +if [ -n "${APP_CONFIG_PLUGIN_CATEGORIES}" ]; then + echo "SET APP_CONFIG_PLUGIN_CATEGORIES" + sed -e "s/\"categoriesEnabled\": [^,]*/\"categoriesEnabled\": ${APP_CONFIG_PLUGIN_CATEGORIES}/g" -i "$APP_CONFIG_FILE" +fi diff --git a/projects/aca-shared/rules/src/app.rules.spec.ts b/projects/aca-shared/rules/src/app.rules.spec.ts index a955b2502..acccfda8c 100644 --- a/projects/aca-shared/rules/src/app.rules.spec.ts +++ b/projects/aca-shared/rules/src/app.rules.spec.ts @@ -947,7 +947,7 @@ describe('app.evaluators', () => { }; app.areTagsEnabled(context); - expect(context.appConfig.get).toHaveBeenCalledWith('plugins.tags', true); + expect(context.appConfig.get).toHaveBeenCalledWith('plugins.tagsEnabled', true); }); it('should return true if get from appConfig returns true', () => { @@ -980,7 +980,7 @@ describe('app.evaluators', () => { }; app.areCategoriesEnabled(context); - expect(context.appConfig.get).toHaveBeenCalledWith('plugins.categories', true); + expect(context.appConfig.get).toHaveBeenCalledWith('plugins.categoriesEnabled', true); }); it('should return true if get from appConfig returns true', () => { diff --git a/projects/aca-shared/rules/src/app.rules.ts b/projects/aca-shared/rules/src/app.rules.ts index 7315b0fcf..6b436b0ed 100644 --- a/projects/aca-shared/rules/src/app.rules.ts +++ b/projects/aca-shared/rules/src/app.rules.ts @@ -647,6 +647,6 @@ export function isSmartFolder(context: RuleContext): boolean { return false; } -export const areTagsEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.tags', true); +export const areTagsEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.tagsEnabled', true); -export const areCategoriesEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.categories', true); +export const areCategoriesEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.categoriesEnabled', true);