From 636bb352c7838e834f5e9d190647d132560b1ca2 Mon Sep 17 00:00:00 2001 From: caydyan Date: Sun, 14 Jun 2026 23:36:11 +0800 Subject: [PATCH 1/2] Add ticket tribe notification link --- src/bounties/BountyModalButtonSet.tsx | 21 +++++++++++++++++++ .../__tests__/BountyModelButtonSet.spec.tsx | 16 +++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/bounties/BountyModalButtonSet.tsx b/src/bounties/BountyModalButtonSet.tsx index 6a2e578b0..060aaa070 100644 --- a/src/bounties/BountyModalButtonSet.tsx +++ b/src/bounties/BountyModalButtonSet.tsx @@ -15,6 +15,9 @@ const ButtonSetContainer = styled.div` const ButtonSet = ({ showGithubBtn, ...props }: any) => { const color = colors['light']; + const hasTribe = + typeof props.tribe === 'string' && props.tribe.toLowerCase() !== 'none'; + return ( { Share to Twitter + {hasTribe && ( + props?.tribeFunction?.()} + style={{ + color: color.blue1, + cursor: 'pointer', + fontSize: '13px', + fontWeight: 500, + lineHeight: '18px', + marginTop: '16px', + maxWidth: '220px' + }} + > + Interested in seeing more tickets like this? Join the tribe and get notified about new + tickets + + )} {props.isOwner && props.show === false && ( <>
{ const tribeButton = screen.getByText(/kotlin/i); expect(tribeButton).toBeInTheDocument(); }); + + it('renders the ticket tribe notification link and opens the tribe when clicked', () => { + const tribeFunction = jest.fn(); + + render(); + + const joinLink = screen.getByTestId('join-tribe-ticket-link'); + expect(joinLink).toHaveTextContent( + 'Interested in seeing more tickets like this? Join the tribe and get notified about new tickets' + ); + + fireEvent.click(joinLink); + expect(tribeFunction).toHaveBeenCalledTimes(1); + }); }); From 7c6c6b33fa131359ddd1b064c57b61857f81ffb8 Mon Sep 17 00:00:00 2001 From: caydyan Date: Sun, 14 Jun 2026 23:55:18 +0800 Subject: [PATCH 2/2] Harden tribe ticket link handling --- src/bounties/BountyModalButtonSet.tsx | 16 ++++++++++++---- .../__tests__/BountyModelButtonSet.spec.tsx | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/bounties/BountyModalButtonSet.tsx b/src/bounties/BountyModalButtonSet.tsx index 060aaa070..25b6e46ba 100644 --- a/src/bounties/BountyModalButtonSet.tsx +++ b/src/bounties/BountyModalButtonSet.tsx @@ -15,8 +15,8 @@ const ButtonSetContainer = styled.div` const ButtonSet = ({ showGithubBtn, ...props }: any) => { const color = colors['light']; - const hasTribe = - typeof props.tribe === 'string' && props.tribe.toLowerCase() !== 'none'; + const tribeName = typeof props.tribe === 'string' ? props.tribe.trim() : ''; + const hasTribe = tribeName.length > 0 && tribeName.toLowerCase() !== 'none'; return ( {
)} - {typeof props.tribe === 'string' && props.tribe !== 'None' ? ( + {hasTribe ? ( { @@ -104,7 +104,7 @@ const ButtonSet = ({ showGithubBtn, ...props }: any) => { /> - {props.tribe.slice(0, 14)} {props.tribe.length > 14 && '...'} + {tribeName.slice(0, 14)} {tribeName.length > 14 && '...'}
{ props?.tribeFunction?.()} + onKeyDown={(event: React.KeyboardEvent) => { + if (event.key === 'Enter' || event.key === ' ') { + event.preventDefault(); + props?.tribeFunction?.(); + } + }} + role="button" style={{ color: color.blue1, cursor: 'pointer', @@ -190,6 +197,7 @@ const ButtonSet = ({ showGithubBtn, ...props }: any) => { marginTop: '16px', maxWidth: '220px' }} + tabIndex={0} > Interested in seeing more tickets like this? Join the tribe and get notified about new tickets diff --git a/src/bounties/__tests__/BountyModelButtonSet.spec.tsx b/src/bounties/__tests__/BountyModelButtonSet.spec.tsx index b4b7732c3..3e5ff083d 100644 --- a/src/bounties/__tests__/BountyModelButtonSet.spec.tsx +++ b/src/bounties/__tests__/BountyModelButtonSet.spec.tsx @@ -37,4 +37,21 @@ describe('BountyModalButtonSet Component', () => { fireEvent.click(joinLink); expect(tribeFunction).toHaveBeenCalledTimes(1); }); + + it('opens the tribe notification link from the keyboard', () => { + const tribeFunction = jest.fn(); + + render(); + + fireEvent.keyDown(screen.getByTestId('join-tribe-ticket-link'), { key: 'Enter' }); + expect(tribeFunction).toHaveBeenCalledTimes(1); + }); + + it('does not render the ticket tribe notification link for missing tribes', () => { + const { rerender } = render(); + expect(screen.queryByTestId('join-tribe-ticket-link')).not.toBeInTheDocument(); + + rerender(); + expect(screen.queryByTestId('join-tribe-ticket-link')).not.toBeInTheDocument(); + }); });