trim names
This commit is contained in:
@@ -21,6 +21,7 @@ import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
|||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {HITSLOP_10} from 'lib/constants'
|
import {HITSLOP_10} from 'lib/constants'
|
||||||
|
import {createSanitizedDisplayName} from 'lib/moderation/create-sanitized-display-name'
|
||||||
import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types'
|
import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types'
|
||||||
import {logEvent} from 'lib/statsig/statsig'
|
import {logEvent} from 'lib/statsig/statsig'
|
||||||
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
||||||
@@ -170,15 +171,7 @@ function WizardInner({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const getDefaultName = () => {
|
const getDefaultName = () => {
|
||||||
let displayName
|
const displayName = createSanitizedDisplayName(currentProfile!, true)
|
||||||
if (
|
|
||||||
currentProfile?.displayName != null &&
|
|
||||||
currentProfile?.displayName !== ''
|
|
||||||
) {
|
|
||||||
displayName = sanitizeDisplayName(currentProfile.displayName)
|
|
||||||
} else {
|
|
||||||
displayName = sanitizeHandle(currentProfile!.handle)
|
|
||||||
}
|
|
||||||
return _(msg`${displayName}'s Starter Pack`).slice(0, 50)
|
return _(msg`${displayName}'s Starter Pack`).slice(0, 50)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,8 +247,8 @@ function WizardInner({
|
|||||||
dispatch({type: 'SetProcessing', processing: true})
|
dispatch({type: 'SetProcessing', processing: true})
|
||||||
if (currentStarterPack && currentListItems) {
|
if (currentStarterPack && currentListItems) {
|
||||||
editStarterPack({
|
editStarterPack({
|
||||||
name: state.name ?? getDefaultName(),
|
name: state.name?.trim() || getDefaultName(),
|
||||||
description: state.description,
|
description: state.description?.trim(),
|
||||||
descriptionFacets: [],
|
descriptionFacets: [],
|
||||||
profiles: state.profiles,
|
profiles: state.profiles,
|
||||||
feeds: state.feeds,
|
feeds: state.feeds,
|
||||||
@@ -264,8 +257,8 @@ function WizardInner({
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
createStarterPack({
|
createStarterPack({
|
||||||
name: state.name ?? getDefaultName(),
|
name: state.name?.trim() || getDefaultName(),
|
||||||
description: state.description,
|
description: state.description?.trim(),
|
||||||
descriptionFacets: [],
|
descriptionFacets: [],
|
||||||
profiles: state.profiles,
|
profiles: state.profiles,
|
||||||
feeds: state.feeds,
|
feeds: state.feeds,
|
||||||
|
|||||||
Reference in New Issue
Block a user