Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Improvements to auto-mentioning users from their profiles (#1556)

* Don't automatically mention users with invalid handles

* don't mention when using did urls

* resolve profile from cache

* a little clearer

---------

Co-authored-by: Samuel Newman <mozzius@protonmail.com>

authored by

Eric Bailey
Samuel Newman
and committed by
GitHub
6325eff9 42723dfa

+22 -6
+4 -1
src/view/screens/Profile.tsx
··· 91 91 const onPressCompose = React.useCallback(() => { 92 92 track('ProfileScreen:PressCompose') 93 93 const mention = 94 - uiState.profile.handle === store.me.handle ? '' : uiState.profile.handle 94 + uiState.profile.handle === store.me.handle || 95 + uiState.profile.handle === 'handle.invalid' 96 + ? undefined 97 + : uiState.profile.handle 95 98 store.shell.openComposer({mention}) 96 99 }, [store, track, uiState]) 97 100 const onSelectView = React.useCallback(
+18 -5
src/view/shell/desktop/LeftNav.tsx
··· 185 185 const {getState} = useNavigation() 186 186 const {isTablet} = useWebMediaQueries() 187 187 188 - const getProfileHandle = () => { 188 + const getProfileHandle = async () => { 189 189 const {routes} = getState() 190 190 const currentRoute = routes[routes.length - 1] 191 + 191 192 if (currentRoute.name === 'Profile') { 192 - const {name: handle} = 193 + let handle: string | undefined = ( 193 194 currentRoute.params as CommonNavigatorParams['Profile'] 194 - if (handle === store.me.handle) return undefined 195 + ).name 196 + 197 + if (handle.startsWith('did:')) { 198 + const cached = await store.profiles.cache.get(handle) 199 + const profile = cached ? cached.data : undefined 200 + // if we can't resolve handle, set to undefined 201 + handle = profile?.handle || undefined 202 + } 203 + 204 + if (!handle || handle === store.me.handle || handle === 'handle.invalid') 205 + return undefined 206 + 195 207 return handle 196 208 } 209 + 197 210 return undefined 198 211 } 199 212 200 - const onPressCompose = () => 201 - store.shell.openComposer({mention: getProfileHandle()}) 213 + const onPressCompose = async () => 214 + store.shell.openComposer({mention: await getProfileHandle()}) 202 215 203 216 if (isTablet) { 204 217 return null