From a7da6462865558c7d3766628f4cd8eabd93b68f9 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Fri, 10 Jan 2025 17:57:10 +0000
Subject: [ELI5] Validate too long handles in signup (#7422)

* validate too long handles in signup

* make change handle screen generic
---
 src/screens/Signup/StepHandle.tsx | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'src/screens/Signup/StepHandle.tsx')

diff --git a/src/screens/Signup/StepHandle.tsx b/src/screens/Signup/StepHandle.tsx
index dee7df848..1d04264ae 100644
--- a/src/screens/Signup/StepHandle.tsx
+++ b/src/screens/Signup/StepHandle.tsx
@@ -4,7 +4,11 @@ import {msg, Trans} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
 import {logEvent} from '#/lib/statsig/statsig'
-import {createFullHandle, validateHandle} from '#/lib/strings/handles'
+import {
+  createFullHandle,
+  maxServiceHandleLength,
+  validateHandle,
+} from '#/lib/strings/handles'
 import {useAgent} from '#/state/session'
 import {ScreenTransition} from '#/screens/Login/ScreenTransition'
 import {useSignupContext} from '#/screens/Signup/state'
@@ -93,7 +97,7 @@ export function StepHandle() {
     })
   }, [dispatch, state.activeStep])
 
-  const validCheck = validateHandle(draftValue, state.userDomain)
+  const validCheck = validateHandle(draftValue, state.userDomain, true)
   return (
     <ScreenTransition>
       <View style={[a.gap_lg]}>
@@ -166,7 +170,10 @@ export function StepHandle() {
               />
               {!validCheck.totalLength ? (
                 <Text style={[a.text_md, a.flex_1]}>
-                  <Trans>No longer than 253 characters</Trans>
+                  <Trans>
+                    No longer than {maxServiceHandleLength(state.userDomain)}{' '}
+                    characters
+                  </Trans>
                 </Text>
               ) : (
                 <Text style={[a.text_md, a.flex_1]}>
-- 
cgit 1.4.1

