From 278960b44cc2c3d3ff43b68a657eb18f38b1a06f Mon Sep 17 00:00:00 2001 From: Marc Itzenthaler Date: Sat, 27 Jan 2024 20:18:05 +0100 Subject: [PATCH 1/2] fix: show start video call only if group chat was joined --- src/components/sessionHeader/GroupChatHeader/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/sessionHeader/GroupChatHeader/index.tsx b/src/components/sessionHeader/GroupChatHeader/index.tsx index 2c8a5d0d1..3edf7692e 100644 --- a/src/components/sessionHeader/GroupChatHeader/index.tsx +++ b/src/components/sessionHeader/GroupChatHeader/index.tsx @@ -165,7 +165,7 @@ export const GroupChatHeader = ({ )} - {!isActive && isConsultant && ( + {(!isActive || isJoinGroupChatView) && isConsultant && ( Date: Sun, 28 Jan 2024 23:16:51 +0100 Subject: [PATCH 2/2] feat: added fallback loader for non unique consulting type slugs --- .env.sample | 4 +++ proxy/config.js | 11 +++++++ .../AppConfig/AppConfigInterface.ts | 7 +++++ src/utils/useUrlParamsLoader.tsx | 29 ++++++++++++++++++- 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index 2d83fb280..1c26ee184 100644 --- a/.env.sample +++ b/.env.sample @@ -23,6 +23,10 @@ CSRF_WHITELIST_HEADER_FOR_LOCAL_DEVELOPMENT=X-WHITELIST-HEADER # Disable 2FA REACT_APP_DISABLE_2FA_DUTY=0 +### Registration +# Enable fallback loader for direct link registration where slug could not be matched (0/1) +FRONTEND_REGISTRATION_DIRECTLINK_FALLBACKLOADER_ENABLED= + ### Weblate # Weblate host FRONTEND_WEBLATE_HOST= diff --git a/proxy/config.js b/proxy/config.js index a0e29796c..12e24da94 100644 --- a/proxy/config.js +++ b/proxy/config.js @@ -12,5 +12,16 @@ module.exports = { disabled: process.env.FRONTEND_TRANSLATION_CACHE_DISABLED || true, time: process.env.FRONTEND_TRANSLATION_CACHE_TIME || 30 } + }, + registration: { + directlink: { + fallbackLoader: { + enabled: !!parseInt( + process.env + .FRONTEND_REGISTRATION_DIRECTLINK_FALLBACKLOADER_ENABLED || + '1' + ) + } + } } }; diff --git a/src/globalState/interfaces/AppConfig/AppConfigInterface.ts b/src/globalState/interfaces/AppConfig/AppConfigInterface.ts index 3563b372e..880bcac39 100644 --- a/src/globalState/interfaces/AppConfig/AppConfigInterface.ts +++ b/src/globalState/interfaces/AppConfig/AppConfigInterface.ts @@ -30,6 +30,13 @@ export interface AppConfigInterface extends AppSettingsInterface { }; }; groupChat?: GroupChatConfig; + registration?: { + directlink?: { + fallbackLoader?: { + enabled?: boolean; + }; + }; + }; } interface ReleaseToggles { diff --git a/src/utils/useUrlParamsLoader.tsx b/src/utils/useUrlParamsLoader.tsx index 294e4fe88..1cb38401f 100644 --- a/src/utils/useUrlParamsLoader.tsx +++ b/src/utils/useUrlParamsLoader.tsx @@ -87,6 +87,32 @@ export default function useUrlParamsLoader() { ) ) { consultingType = null; + + // Fallback logic for special client because slug is not unique. So try reversed logicc + if ( + settings?.registration?.directlink + ?.fallbackLoader?.enabled && + consultingTypeSlug + ) { + const loadConsultingType = async (id) => { + const ct = await apiGetConsultingType({ + consultingTypeId: id + }); + return ct.slug === consultingTypeSlug + ? ct + : null; + }; + + for (const { + consultingType: ctId + } of consultant.agencies) { + const res = await loadConsultingType(ctId); + if (res) { + consultingType = res; + break; + } + } + } } } } @@ -131,7 +157,8 @@ export default function useUrlParamsLoader() { consultantId, topicIdOrName, settings.multitenancyWithSingleDomainEnabled, - settings.urls.toRegistration + settings.urls.toRegistration, + settings?.registration?.directlink?.fallbackLoader?.enabled ]); useEffect(() => {