Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Explore] Moderate trending topic avis (#8123)

* moderate trending topic avis

* filter blurs too

authored by

Samuel Newman and committed by
GitHub
fa084284 93af0132

+25 -4
+1 -1
src/components/AvatarStack.tsx
··· 6 6 import {useProfilesQuery} from '#/state/queries/profile' 7 7 import {UserAvatar} from '#/view/com/util/UserAvatar' 8 8 import {atoms as a, useTheme} from '#/alf' 9 - import * as bsky from '#/types/bsky' 9 + import type * as bsky from '#/types/bsky' 10 10 11 11 export function AvatarStack({ 12 12 profiles,
+24 -3
src/screens/Search/modules/ExploreTrendingTopics.tsx
··· 1 + import {useMemo} from 'react' 1 2 import {Pressable, View} from 'react-native' 2 - import {type AppBskyUnspeccedDefs} from '@atproto/api' 3 + import {type AppBskyUnspeccedDefs, moderateProfile} from '@atproto/api' 3 4 import {msg, plural, Trans} from '@lingui/macro' 4 5 import {useLingui} from '@lingui/react' 5 6 6 7 import {logger} from '#/logger' 8 + import {useModerationOpts} from '#/state/preferences/moderation-opts' 7 9 import {useTrendingSettings} from '#/state/preferences/trending' 8 10 import {useGetTrendsQuery} from '#/state/queries/trending/useGetTrendsQuery' 9 11 import {useTrendingConfig} from '#/state/trending-config' ··· 78 80 ) 79 81 : null 80 82 83 + const actors = useModerateTrendingActors(trend.actors) 84 + 81 85 return ( 82 86 <Link 83 87 testID={trend.link} ··· 118 122 a.align_center, 119 123 {paddingLeft: 20}, 120 124 ]}> 121 - {trend.actors.length > 0 && ( 122 - <AvatarStack size={20} profiles={trend.actors} /> 125 + {actors.length > 0 && ( 126 + <AvatarStack size={20} profiles={actors} /> 123 127 )} 124 128 <Text 125 129 style={[ ··· 276 280 </View> 277 281 ) 278 282 } 283 + 284 + function useModerateTrendingActors( 285 + actors: AppBskyUnspeccedDefs.TrendView['actors'], 286 + ) { 287 + const moderationOpts = useModerationOpts() 288 + 289 + return useMemo(() => { 290 + if (!moderationOpts) return [] 291 + 292 + return actors 293 + .filter(actor => { 294 + const decision = moderateProfile(actor, moderationOpts) 295 + return !decision.ui('avatar').filter && !decision.ui('avatar').blur 296 + }) 297 + .slice(0, 3) 298 + }, [actors, moderationOpts]) 299 + }