diff --git a/src/renderer/src/components/App/OrgHead.cy.tsx b/src/renderer/src/components/App/OrgHead.cy.tsx index 2285b88..07b2f05 100644 --- a/src/renderer/src/components/App/OrgHead.cy.tsx +++ b/src/renderer/src/components/App/OrgHead.cy.tsx @@ -549,4 +549,51 @@ describe('OrgHead', () => { // Should NOT display the organization name cy.contains(orgName).should('not.exist'); }); + + it('should remove leading > and trailing < characters from organization names', () => { + const orgId = 'test-org-id'; + // Test with name that starts with > + const orgNameWithPrefix = '>Test Organization'; + const orgDataWithPrefix = createMockOrganization(orgId, orgNameWithPrefix); + + mountOrgHead(createInitialState(), ['/team'], orgId, orgDataWithPrefix); + + // The displayed name should not start with > + cy.get('h6, [variant="h6"]') + .should('be.visible') + .then(($el) => { + const displayedText = $el.text(); + expect(displayedText.startsWith('>')).to.be.false; + expect(displayedText).to.equal('Test Organization'); + }); + + // Test with name that ends with < + const orgNameWithSuffix = 'Test Organization<'; + const orgDataWithSuffix = createMockOrganization(orgId, orgNameWithSuffix); + + mountOrgHead(createInitialState(), ['/team'], orgId, orgDataWithSuffix); + + // The displayed name should not end with < + cy.get('h6, [variant="h6"]') + .should('be.visible') + .then(($el) => { + const displayedText = $el.text(); + expect(displayedText.endsWith('<')).to.be.false; + expect(displayedText).to.equal('Test Organization'); + }); + const orgNameWithBoth = '>Test Organization<'; + const orgDataWithBoth = createMockOrganization(orgId, orgNameWithBoth); + + mountOrgHead(createInitialState(), ['/team'], orgId, orgDataWithBoth); + + // The displayed name should not start with > or end with < + cy.get('h6, [variant="h6"]') + .should('be.visible') + .then(($el) => { + const displayedText = $el.text(); + expect(displayedText.startsWith('>')).to.be.false; + expect(displayedText.endsWith('<')).to.be.false; + expect(displayedText).to.equal('Test Organization'); + }); + }); }); diff --git a/src/renderer/src/components/App/OrgHead.tsx b/src/renderer/src/components/App/OrgHead.tsx index 39cb244..b5f2ffe 100644 --- a/src/renderer/src/components/App/OrgHead.tsx +++ b/src/renderer/src/components/App/OrgHead.tsx @@ -85,6 +85,18 @@ export const OrgHead = () => { setOpenMember(true); }; + const cleanOrgName = (orgRec: OrganizationD | undefined) => { + let name = orgRec?.attributes.name; + if (!name) return ''; + if (name.startsWith('>')) { + name = name.slice(1); + } + if (name.endsWith('<')) { + name = name.slice(0, -1); + } + return name; + }; + return ( { > {isSwitchTeamsScreen ? API_CONFIG.productName - : orgRec?.attributes.name || API_CONFIG.productName} + : cleanOrgName(orgRec) || API_CONFIG.productName} {isTeamScreen && ( <>