From 57b5763d413784c5b24b31b423adea3d0b26ee32 Mon Sep 17 00:00:00 2001 From: Jackson Roberts Date: Fri, 10 Apr 2026 05:09:40 +0000 Subject: [PATCH] fix(opportunity): remove synthetic Contact suffix in contact field --- api/src/controllers/OpportunityController.ts | 18 ++++++++++++++++-- dalpuri/src/translations/contact.ts | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/api/src/controllers/OpportunityController.ts b/api/src/controllers/OpportunityController.ts index 5a42a76..fd77575 100644 --- a/api/src/controllers/OpportunityController.ts +++ b/api/src/controllers/OpportunityController.ts @@ -76,6 +76,20 @@ function mapRatingNameToInterest( return null; } +function formatOpportunityContactName( + firstName?: string | null, + lastName?: string | null +): string { + const first = (firstName ?? "").trim(); + const last = (lastName ?? "").trim(); + + if (first && last.toLowerCase() === "contact") { + return first; + } + + return `${first} ${last}`.trim(); +} + /** * Opportunity Controller * @@ -290,7 +304,7 @@ export class OpportunityController { | null | undefined; this.contactName = (data as any).contactName ?? (contactRel - ? `${contactRel.firstName} ${contactRel.lastName}`.trim() + ? formatOpportunityContactName(contactRel.firstName, contactRel.lastName) : null); // Site @@ -674,7 +688,7 @@ export class OpportunityController { id: contact.id, contact: { id: contact.id, - name: `${contact.firstName} ${contact.lastName}`.trim(), + name: formatOpportunityContactName(contact.firstName, contact.lastName), }, company: contact.company ? { diff --git a/dalpuri/src/translations/contact.ts b/dalpuri/src/translations/contact.ts index ea03dda..37bc863 100644 --- a/dalpuri/src/translations/contact.ts +++ b/dalpuri/src/translations/contact.ts @@ -46,7 +46,7 @@ export const contactTranslation: Translation = { { from: "lastName", to: "lastName", - process: (value) => (value ? value : "Contact"), + process: (value) => (value ? value : ""), }, { from: "nickName", to: "nickname" }, { from: "title", to: "title" },