The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Preserve record access before chat metadata is provisioned (#26536)
Félix Malfaitee83231f18d1
diff --git a/packages/twenty-server/src/engine/core-modules/record-share/utils/__tests__/is-legacy-record-access-open.util.spec.ts b/packages/twenty-server/src/engine/core-modules/record-share/utils/__tests__/is-legacy-record-access-open.util.spec.tsindex 49e91bf7193..8229d2409c4 100644--- a/packages/twenty-server/src/engine/core-modules/record-share/utils/__tests__/is-legacy-record-access-open.util.spec.ts+++ b/packages/twenty-server/src/engine/core-modules/record-share/utils/__tests__/is-legacy-record-access-open.util.spec.ts@@ -39,3 +39,15 @@ it.each([).toBe('deny');},);++it.each([false, true])(+ 'keeps unprovisioned workspaces on historical enforcement (%s)',+ (wasRecordSharingEnabled) => {+ expect(+ isLegacyRecordAccessOpen({+ flatObjectMetadataMaps: { byUniversalIdentifier: {} },+ wasRecordSharingEnabled,+ }),+ ).toBe(!wasRecordSharingEnabled);+ },+);diff --git a/packages/twenty-server/src/engine/core-modules/record-share/utils/is-legacy-record-access-open.util.ts b/packages/twenty-server/src/engine/core-modules/record-share/utils/is-legacy-record-access-open.util.tsindex 7062520fcfe..af21f9293e1 100644--- a/packages/twenty-server/src/engine/core-modules/record-share/utils/is-legacy-record-access-open.util.ts+++ b/packages/twenty-server/src/engine/core-modules/record-share/utils/is-legacy-record-access-open.util.ts@@ -1,5 +1,6 @@import { STANDARD_OBJECTS } from 'twenty-shared/metadata';import { MetadataReadability } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';export const isLegacyRecordAccessOpen = ({flatObjectMetadataMaps,@@ -17,9 +18,9 @@ export const isLegacyRecordAccessOpen = ({flatObjectMetadataMaps.byUniversalIdentifier[STANDARD_OBJECTS.agentChatThread.universalIdentifier];- // SYSTEM stays in place until compatibility grants have committed.+ // Missing or SYSTEM metadata has not passed the compatibility backfill yet.return (- thread?.readability === MetadataReadability.SYSTEM &&+ (!isDefined(thread) || thread.readability === MetadataReadability.SYSTEM) &&!wasRecordSharingEnabled);};