The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
better logging in order to investigate later one on this kind of error (#12326)
Guillim017940b2cb28
diff --git a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsxindex fa47d4928ff..3090dfaa42e 100644--- a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx+++ b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx@@ -48,6 +48,7 @@ export const RecordChip = ({const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);// TODO temporary until we create a record show page for Workspaces members+if (forceDisableClick ||objectNameSingular === CoreObjectNameSingular.WorkspaceMember@@ -61,7 +62,7 @@ export const RecordChip = ({avatarType={recordChipData.avatarType}avatarUrl={recordChipData.avatarUrl ?? ''}className={className}- variant={ChipVariant.Static}+ variant={ChipVariant.Transparent}/>);}diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/display/components/ActorFieldDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/display/components/ActorFieldDisplay.tsxindex 530b92b58f8..f0c35b7fee1 100644--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/display/components/ActorFieldDisplay.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/display/components/ActorFieldDisplay.tsx@@ -12,6 +12,7 @@ export const ActorFieldDisplay = () => {}const { fieldValue, name, avatarUrl } = actorFieldDisplay;+return displayActorField ? (<ActorDisplayname={name}diff --git a/packages/twenty-server/src/utils/__test__/get-domain-name-by-email.spec.ts b/packages/twenty-server/src/utils/__test__/get-domain-name-by-email.spec.tsindex 7eb92c9fd21..65c85b50a41 100644--- a/packages/twenty-server/src/utils/__test__/get-domain-name-by-email.spec.ts+++ b/packages/twenty-server/src/utils/__test__/get-domain-name-by-email.spec.ts@@ -24,4 +24,53 @@ describe('getDomainNameByEmail', () => {it('should throw an error if domain part is empty', () => {expect(() => getDomainNameByEmail('user@')).toThrow('Invalid email format');});++ // Edge cases with weird but potentially valid email formats+ it('should handle email with plus addressing', () => {+ expect(getDomainNameByEmail('[email protected]')).toBe('example.com');+ });++ it('should handle email with dots in local part', () => {+ expect(getDomainNameByEmail('[email protected]')).toBe('example.com');+ });++ it('should handle email with subdomain', () => {+ expect(getDomainNameByEmail('[email protected]')).toBe(+ 'mail.example.com',+ );+ });++ it('should handle email with numeric domain', () => {+ expect(getDomainNameByEmail('[email protected]')).toBe('123.456.1.2');+ });++ it('should handle email with hyphenated domain', () => {+ expect(getDomainNameByEmail('[email protected]')).toBe('my-domain.com');+ });++ it('should handle email with international domain (punycode)', () => {+ expect(getDomainNameByEmail('[email protected]')).toBe(+ 'xn--nxasmq6b.com',+ );+ });++ it('should handle email with very long domain', () => {+ const longDomain = 'a'.repeat(160) + '.com';++ expect(getDomainNameByEmail(`user@${longDomain}`)).toBe(longDomain);+ });++ it('should handle email with quoted local part containing spaces', () => {+ expect(getDomainNameByEmail('"user name"@example.com')).toBe('example.com');+ });++ xit('should handle email with special characters in quoted local part', () => {+ expect(getDomainNameByEmail('"user@#$%"@example.com')).toBe('example.com');+ });++ xit('should handle email with quoted local part containing @', () => {+ expect(getDomainNameByEmail('"user@local"@example.com')).toBe(+ 'example.com',+ );+ });});diff --git a/packages/twenty-server/src/utils/get-domain-name-by-email.ts b/packages/twenty-server/src/utils/get-domain-name-by-email.tsindex ed1b8a7c2f9..0261fa4b1bf 100644--- a/packages/twenty-server/src/utils/get-domain-name-by-email.ts+++ b/packages/twenty-server/src/utils/get-domain-name-by-email.ts@@ -1,18 +1,20 @@+import { isNonEmptyString } from '@sniptt/guards';+export const getDomainNameByEmail = (email: string) => {- if (!email) {+ if (!isNonEmptyString(email)) {throw new Error('Email is required');}const fields = email.split('@');if (fields.length !== 2) {- throw new Error('Invalid email format');+ throw new Error(`Invalid email format (${fields.length - 1} @) ${email}`);}const domain = fields[1];if (!domain) {- throw new Error('Invalid email format');+ throw new Error(`Invalid email format (no domain) ${email}`);}return domain;