feat: use CONTACT_MAX_NAME_LENGTH

as max length for session inputs for user profile name
pull/3083/head
William Grant 9 months ago
parent 5ef5fc59a8
commit bc2e28b6b7

@ -10,6 +10,7 @@ import { YourSessionIDPill, YourSessionIDSelectable } from '../../basic/YourSess
import { useHotkey } from '../../../hooks/useHotkey';
import { useOurAvatarPath, useOurConversationUsername } from '../../../hooks/useParamSelector';
import { ProfileManager } from '../../../session/profile_manager/ProfileManager';
import LIBSESSION_CONSTANTS from '../../../session/utils/libsession/libsession_constants';
import { editProfileModal, updateEditProfilePictureModel } from '../../../state/ducks/modalDialog';
import { SessionWrapperModal } from '../../SessionWrapperModal';
import { Flex } from '../../basic/Flex';
@ -332,6 +333,7 @@ export const EditProfileDialog = () => {
tabIndex={0}
required={true}
error={profileNameError}
maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH}
textSize={'xl'}
centerText={true}
inputRef={inputRef}

@ -6,6 +6,7 @@ import { mnDecode } from '../../../session/crypto/mnemonic';
import { ProfileManager } from '../../../session/profile_manager/ProfileManager';
import { StringUtils } from '../../../session/utils';
import { fromHex } from '../../../session/utils/String';
import LIBSESSION_CONSTANTS from '../../../session/utils/libsession/libsession_constants';
import { trigger } from '../../../shims/events';
import {
AccountCreation,
@ -164,6 +165,7 @@ export const CreateAccount = () => {
}}
onEnterPressed={signUpWithDetails}
error={displayNameError}
maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH}
inputDataTestId="display-name-input"
/>
<SpacerLG />

@ -7,6 +7,7 @@ import { ProfileManager } from '../../../session/profile_manager/ProfileManager'
import { PromiseUtils } from '../../../session/utils';
import { TaskTimedOutError } from '../../../session/utils/Promise';
import { NotFoundError } from '../../../session/utils/errors';
import LIBSESSION_CONSTANTS from '../../../session/utils/libsession/libsession_constants';
import { trigger } from '../../../shims/events';
import {
AccountRestoration,
@ -253,6 +254,7 @@ export const RestoreAccount = () => {
}}
onEnterPressed={recoverAndFetchDisplayName}
error={recoveryPasswordError}
maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH}
enableShowHideButton={true}
showHideButtonAriaLabels={{
hide: 'Hide recovery password toggle',

@ -0,0 +1,12 @@
import { CONSTANTS, ConstantsType } from 'libsession_util_nodejs';
const { CONTACT_MAX_NAME_LENGTH, BASE_GROUP_MAX_NAME_LENGTH, GROUP_INFO_MAX_NAME_LENGTH } =
CONSTANTS;
const LIBSESSION_CONSTANTS: ConstantsType = {
CONTACT_MAX_NAME_LENGTH,
BASE_GROUP_MAX_NAME_LENGTH,
GROUP_INFO_MAX_NAME_LENGTH,
};
export default LIBSESSION_CONSTANTS;
Loading…
Cancel
Save