From 65589cb5d346d0ec9573f7008e3cf55c955d1e45 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 13 Jul 2026 14:30:22 -0500 Subject: [PATCH] Reuse moderateProfile to take advantage of the filter convenience getter --- src/analytics/metrics/types.ts | 2 + .../PostThread/components/LikesStat.tsx | 59 +++++++++++-------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/analytics/metrics/types.ts b/src/analytics/metrics/types.ts index b988595bb2..ef875ff5bf 100644 --- a/src/analytics/metrics/types.ts +++ b/src/analytics/metrics/types.ts @@ -1461,4 +1461,6 @@ export type Events = { jobId?: string elapsedInPhaseMs: number } + + 'post:likedBy:click': {} } diff --git a/src/screens/PostThread/components/LikesStat.tsx b/src/screens/PostThread/components/LikesStat.tsx index 4316b0b9b9..7b6182d3c0 100644 --- a/src/screens/PostThread/components/LikesStat.tsx +++ b/src/screens/PostThread/components/LikesStat.tsx @@ -54,27 +54,33 @@ export function LikesStat({post}: {post: AppBskyFeedDefs.PostView}) { const urip = new AtUri(post.uri) const likesHref = makeProfileLink(post.author, 'post', urip.rkey, 'liked-by') + const onPressLikedBy = () => ax.metric('post:likedBy:click', {}) - const knownLikers = moderationOpts + const knownLikersAndModeration = moderationOpts ? (data?.likes ?? []) .map(like => like.actor) - .filter( - actor => - actor.did !== currentAccount?.did && - actor.viewer?.following && - !actor.viewer.muted && - !actor.viewer.blocking && - !actor.viewer.blockedBy, - ) + .map(actor => ({ + actor, + moderation: moderateProfile(actor, moderationOpts), + })) + .filter(({actor, moderation}) => { + const modui = moderation.ui('profileList') + const isMe = actor.did === currentAccount?.did + const following = actor.viewer?.following + return !isMe && following && !modui.filter + }) : [] const showKnownLikers = - knownLikers.length > 0 && + knownLikersAndModeration.length > 0 && ax.features.enabled(ax.features.PostThreadKnownLikersEnable) if (!showKnownLikers) { return ( - + @@ -89,17 +95,21 @@ export function LikesStat({post}: {post: AppBskyFeedDefs.PostView}) { ) } - const names = knownLikers.slice(0, 2).map(actor => { - const moderation = moderateProfile(actor, moderationOpts!) - return { - did: actor.did, - href: makeProfileLink(actor), - displayName: sanitizeDisplayName( - actor.displayName || actor.handle, - moderation.ui('displayName'), - ), - } - }) + const aviStackProfiles = knownLikersAndModeration + .slice(0, 3) + .map(({actor}) => actor) + const names = knownLikersAndModeration + .slice(0, 2) + .map(({actor, moderation}) => { + return { + did: actor.did, + href: makeProfileLink(actor), + displayName: sanitizeDisplayName( + actor.displayName || actor.handle, + moderation.ui('displayName'), + ), + } + }) const others = likeCount - names.length /* @@ -151,8 +161,9 @@ export function LikesStat({post}: {post: AppBskyFeedDefs.PostView}) { - + style={[a.flex_row, a.align_center, a.gap_sm, a.flex_shrink]} + onPress={onPressLikedBy}> +