Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Invalid handle autocomplete (#2251)

* refactor invalid handle check from a previous PR to use util function

* add invalid handle check to `prefixMatch`

authored by

Samuel Newman and committed by
GitHub
4a93a5b6 946b2c91

+6 -3
+2 -1
src/state/queries/actor-autocomplete.ts
··· 11 11 getModerationOpts, 12 12 useModerationOpts, 13 13 } from './preferences' 14 + import {isInvalidHandle} from '#/lib/strings/handles' 14 15 15 16 const DEFAULT_MOD_OPTS = getModerationOpts({ 16 17 userDid: '', ··· 119 120 prefix: string, 120 121 info: AppBskyActorDefs.ProfileViewBasic, 121 122 ): boolean { 122 - if (info.handle.includes(prefix)) { 123 + if (!isInvalidHandle(info.handle) && info.handle.includes(prefix)) { 123 124 return true 124 125 } 125 126 if (info.displayName?.toLocaleLowerCase().includes(prefix)) {
+2 -1
src/view/screens/Profile.tsx
··· 39 39 import {Text} from '#/view/com/util/text/Text' 40 40 import {usePalette} from 'lib/hooks/usePalette' 41 41 import {isNative} from '#/platform/detection' 42 + import {isInvalidHandle} from '#/lib/strings/handles' 42 43 43 44 interface SectionRef { 44 45 scrollToTop: () => void ··· 231 232 track('ProfileScreen:PressCompose') 232 233 const mention = 233 234 profile.handle === currentAccount?.handle || 234 - profile.handle === 'handle.invalid' 235 + isInvalidHandle(profile.handle) 235 236 ? undefined 236 237 : profile.handle 237 238 openComposer({mention})
+2 -1
src/view/shell/desktop/LeftNav.tsx
··· 46 46 import {useFetchHandle} from '#/state/queries/handle' 47 47 import {emitSoftReset} from '#/state/events' 48 48 import {NavSignupCard} from '#/view/shell/NavSignupCard' 49 + import {isInvalidHandle} from '#/lib/strings/handles' 49 50 50 51 function ProfileCard() { 51 52 const {currentAccount} = useSession() ··· 221 222 if ( 222 223 !handle || 223 224 handle === currentAccount?.handle || 224 - handle === 'handle.invalid' 225 + isInvalidHandle(handle) 225 226 ) 226 227 return undefined 227 228