Improved service handle validation logic (#7657)
* fix validation logic for 3p pdses * fix bad import * add service handle validation test
This commit is contained in:
@@ -17,8 +17,8 @@ import {useMutation, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {HITSLOP_10} from '#/lib/constants'
|
||||
import {cleanError} from '#/lib/strings/errors'
|
||||
import {createFullHandle, validateServiceHandle} from '#/lib/strings/handles'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {createFullHandle, validateHandle} from '#/lib/strings/handles'
|
||||
import {useFetchDid, useUpdateHandleMutation} from '#/state/queries/handle'
|
||||
import {RQKEY as RQKEY_PROFILE} from '#/state/queries/profile'
|
||||
import {useServiceQuery} from '#/state/queries/service'
|
||||
@@ -172,7 +172,7 @@ function ProvidedHandlePage({
|
||||
const host = serviceInfo.availableUserDomains[0]
|
||||
|
||||
const validation = useMemo(
|
||||
() => validateHandle(subdomain, host, true),
|
||||
() => validateServiceHandle(subdomain, host),
|
||||
[subdomain, host],
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {logEvent} from '#/lib/statsig/statsig'
|
||||
import {
|
||||
createFullHandle,
|
||||
maxServiceHandleLength,
|
||||
validateHandle,
|
||||
validateServiceHandle,
|
||||
} from '#/lib/strings/handles'
|
||||
import {useAgent} from '#/state/session'
|
||||
import {ScreenTransition} from '#/screens/Login/ScreenTransition'
|
||||
@@ -37,7 +37,7 @@ export function StepHandle() {
|
||||
value: handle,
|
||||
})
|
||||
|
||||
const newValidCheck = validateHandle(handle, state.userDomain)
|
||||
const newValidCheck = validateServiceHandle(handle, state.userDomain)
|
||||
if (!newValidCheck.overall) {
|
||||
return
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export function StepHandle() {
|
||||
})
|
||||
}, [dispatch, state.activeStep])
|
||||
|
||||
const validCheck = validateHandle(draftValue, state.userDomain, true)
|
||||
const validCheck = validateServiceHandle(draftValue, state.userDomain)
|
||||
return (
|
||||
<ScreenTransition>
|
||||
<View style={[a.gap_lg]}>
|
||||
|
||||
Reference in New Issue
Block a user