From fad87f2975821cd544a0a06df6ae3d1a72deee93 Mon Sep 17 00:00:00 2001 From: Chris Bongers Date: Fri, 24 Jul 2026 13:51:19 +0200 Subject: [PATCH 1/2] fix: restore promoted by ad attribution --- .../src/components/cards/ad/AdCard.spec.tsx | 27 +++++++++++++++---- .../shared/src/components/cards/ad/AdGrid.tsx | 2 +- .../shared/src/components/cards/ad/AdList.tsx | 5 +++- .../src/components/cards/ad/SignalAdList.tsx | 1 + .../cards/ad/common/AdAttribution.tsx | 22 +++++++++++++-- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/packages/shared/src/components/cards/ad/AdCard.spec.tsx b/packages/shared/src/components/cards/ad/AdCard.spec.tsx index 65ca2e2c9a1..d543379dfe4 100644 --- a/packages/shared/src/components/cards/ad/AdCard.spec.tsx +++ b/packages/shared/src/components/cards/ad/AdCard.spec.tsx @@ -180,7 +180,13 @@ it('should render advertise link on grid ad', () => { }); const promotedMatcher = (_: string, element?: Element | null): boolean => - getNormalizedText(element) === 'Promoted'; + getNormalizedText(element) === 'Promoted' || + getNormalizedText(element).startsWith('Promoted by '); + +const promotedByMatcher = + (source: string) => + (_: string, element?: Element | null): boolean => + getNormalizedText(element) === `Promoted by ${source}`; it('should render promoted attribution outside of list title clamp', async () => { renderListComponent(); @@ -190,7 +196,7 @@ it('should render promoted attribution outside of list title clamp', async () => expect(await screen.findByText(promotedMatcher)).toBeInTheDocument(); }); -it('should render plain Promoted attribution without source link', async () => { +it('should render promoted attribution with source link', async () => { renderListComponent({ ad: { ...ad, @@ -199,10 +205,21 @@ it('should render plain Promoted attribution without source link', async () => { }, }); - const attribution = await screen.findByText(promotedMatcher); + const attribution = await screen.findByText(promotedByMatcher('Carbon')); + const link = attribution.closest('a'); + + expect(link).toHaveAttribute('href', 'https://example.com/referral'); + expect(link).toHaveAttribute('target', '_blank'); + expect(link).toHaveAttribute('rel', 'noopener'); +}); + +it('should render plain Promoted attribution without source link', async () => { + renderListComponent(); + + const attribution = await screen.findByText( + (_, element) => getNormalizedText(element) === 'Promoted', + ); expect(attribution.tagName).not.toBe('A'); - expect(screen.queryByText(/Promoted by/)).not.toBeInTheDocument(); - expect(screen.queryByText(/Carbon/)).not.toBeInTheDocument(); }); it('should render Promoted attribution in grid variant', async () => { diff --git a/packages/shared/src/components/cards/ad/AdGrid.tsx b/packages/shared/src/components/cards/ad/AdGrid.tsx index acd36d6fdf6..5268bcb5b54 100644 --- a/packages/shared/src/components/cards/ad/AdGrid.tsx +++ b/packages/shared/src/components/cards/ad/AdGrid.tsx @@ -59,7 +59,7 @@ export const AdGrid = forwardRef(function AdGrid( className="!items-end" /> ) : null} - + {!useGlass && ( diff --git a/packages/shared/src/components/cards/ad/AdList.tsx b/packages/shared/src/components/cards/ad/AdList.tsx index d157a80697f..60d2af44fdd 100644 --- a/packages/shared/src/components/cards/ad/AdList.tsx +++ b/packages/shared/src/components/cards/ad/AdList.tsx @@ -82,7 +82,10 @@ export const AdList = forwardRef(function AdCard( {adImprovementsV3 && matchingTags.length > 0 ? ( ) : null} - + diff --git a/packages/shared/src/components/cards/ad/SignalAdList.tsx b/packages/shared/src/components/cards/ad/SignalAdList.tsx index cc3487b4f00..6f8911b9c67 100644 --- a/packages/shared/src/components/cards/ad/SignalAdList.tsx +++ b/packages/shared/src/components/cards/ad/SignalAdList.tsx @@ -92,6 +92,7 @@ export const SignalAdList = forwardRef(function SignalAdList( · + {promotedText} + + ); + } return (
From d71938bb968c1325191524bc6cbcf33fcf9ea7c6 Mon Sep 17 00:00:00 2001 From: Chris Bongers Date: Fri, 24 Jul 2026 13:58:22 +0200 Subject: [PATCH 2/2] fix: pass ad to sidebar attribution --- packages/shared/src/components/post/PostSidebarAdWidget.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/components/post/PostSidebarAdWidget.tsx b/packages/shared/src/components/post/PostSidebarAdWidget.tsx index 654698b766e..897027b4803 100644 --- a/packages/shared/src/components/post/PostSidebarAdWidget.tsx +++ b/packages/shared/src/components/post/PostSidebarAdWidget.tsx @@ -147,7 +147,7 @@ export function PostSidebarAdWidget({ )}
- + ยท @@ -232,7 +232,7 @@ export function PostSidebarAdWidget({ {company} )} - + {hasDescription && (