From be4e8da65615bb93aa3c455e7fea7014bf9798e3 Mon Sep 17 00:00:00 2001 From: Joseph Miclaus Date: Tue, 3 Nov 2026 10:20:18 +0100 Subject: [PATCH] fix: show follows-you tags in following lists --- resources/js/pages/user/connections.tsx | 5 ++-- tests/Unit/FollowState.test.tsx | 31 ++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/resources/js/pages/user/connections.tsx b/resources/js/pages/user/connections.tsx index 0bd7ba217..5dc214370 100644 --- a/resources/js/pages/user/connections.tsx +++ b/resources/js/pages/user/connections.tsx @@ -268,8 +268,9 @@ export default function Connections({ > @{person.handle}

- {type === 'followers' && - knowsFollowers && + {(type === 'following' || + (type === 'followers' && + knowsFollowers)) && person.follows_you && ( Follows you diff --git a/tests/Unit/FollowState.test.tsx b/tests/Unit/FollowState.test.tsx index c8c024443..8de8f178c 100644 --- a/tests/Unit/FollowState.test.tsx +++ b/tests/Unit/FollowState.test.tsx @@ -338,7 +338,7 @@ for (const type of [ 'mutuals', ] as const) { for (const followsYou of [true, false]) { - test(`${type} shows the follows-you badge only for a viewer's follower on the Followers tab (${followsYou})`, () => { + test(`${type} shows the follows-you badge only for a viewer's follower on the Followers or Following tab (${followsYou})`, () => { const page = Connections({ user: suggestion('someone-else'), type, @@ -358,9 +358,9 @@ for (const type of [ assert.equal( find(page, (props) => props.children === 'Follows you') !== null, - type === 'followers' && followsYou, + (type === 'followers' || type === 'following') && followsYou, ); - if (type === 'followers' && followsYou) { + if ((type === 'followers' || type === 'following') && followsYou) { const handleRow = find( page, (props) => @@ -383,6 +383,31 @@ for (const type of [ } } +for (const followsYou of [true, false]) { + test(`your own Following list shows the follows-you badge only for a viewer's follower (${followsYou})`, () => { + const page = Connections({ + user: suggestion('viewer'), + type: 'following', + users: { + data: [ + { + ...suggestion('own-following'), + is_followed: true, + follows_you: followsYou, + }, + ], + next_cursor: null, + prev_cursor: null, + }, + }); + + assert.equal( + find(page, (props) => props.children === 'Follows you') !== null, + followsYou, + ); + }); +} + for (const isFollowing of [true, false]) { test(`your own Followers list hides the redundant follows-you badge (following=${isFollowing})`, () => { const page = Connections({