fix: replace MAX_GROUP_NAME_LENGTH

using libsession BASE_GROUP_MAX_NAME_LENGTH
pull/3083/head
yougotwill 9 months ago
parent 42813c0926
commit 182f5605a5

@ -5,7 +5,6 @@ import { motion } from 'framer-motion';
import { Component } from 'react'; import { Component } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { ConversationModel } from '../../models/conversation'; import { ConversationModel } from '../../models/conversation';
import { Constants } from '../../session';
import { getConversationController } from '../../session/conversations'; import { getConversationController } from '../../session/conversations';
import { initiateClosedGroupUpdate } from '../../session/group/closed-group'; import { initiateClosedGroupUpdate } from '../../session/group/closed-group';
import { initiateOpenGroupUpdate } from '../../session/group/open-group'; import { initiateOpenGroupUpdate } from '../../session/group/open-group';
@ -16,6 +15,7 @@ import { SessionWrapperModal } from '../SessionWrapperModal';
import { Avatar, AvatarSize } from '../avatar/Avatar'; import { Avatar, AvatarSize } from '../avatar/Avatar';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton'; import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton';
import { SpacerMD } from '../basic/Text'; import { SpacerMD } from '../basic/Text';
import LIBSESSION_CONSTANTS from '../../session/utils/libsession/libsession_constants';
const StyledErrorMessage = styled(motion.p)` const StyledErrorMessage = styled(motion.p)`
text-align: center; text-align: center;
@ -71,7 +71,7 @@ export class UpdateGroupNameDialog extends Component<Props, State> {
return; return;
} }
if (trimmedGroupName.length > Constants.VALIDATION.MAX_GROUP_NAME_LENGTH) { if (trimmedGroupName.length > LIBSESSION_CONSTANTS.BASE_GROUP_MAX_NAME_LENGTH) {
this.onShowError(window.i18n('invalidGroupNameTooLong')); this.onShowError(window.i18n('invalidGroupNameTooLong'));
return; return;
@ -139,7 +139,7 @@ export class UpdateGroupNameDialog extends Component<Props, State> {
required={true} required={true}
aria-required={true} aria-required={true}
autoFocus={true} autoFocus={true}
maxLength={Constants.VALIDATION.MAX_GROUP_NAME_LENGTH} maxLength={LIBSESSION_CONSTANTS.BASE_GROUP_MAX_NAME_LENGTH}
data-testid="group-name-input" data-testid="group-name-input"
/> />
) : null} ) : null}

@ -26,6 +26,7 @@ import { Flex } from '../../basic/Flex';
import { SpacerLG, SpacerMD } from '../../basic/Text'; import { SpacerLG, SpacerMD } from '../../basic/Text';
import { SessionInput } from '../../inputs'; import { SessionInput } from '../../inputs';
import { StyledLeftPaneOverlay } from './OverlayMessage'; import { StyledLeftPaneOverlay } from './OverlayMessage';
import LIBSESSION_CONSTANTS from '../../../session/utils/libsession/libsession_constants';
const StyledMemberListNoContacts = styled.div` const StyledMemberListNoContacts = styled.div`
text-align: center; text-align: center;
@ -99,7 +100,7 @@ async function createClosedGroupWithErrorHandling(
onError(window.i18n('invalidGroupNameTooShort')); onError(window.i18n('invalidGroupNameTooShort'));
return false; return false;
} }
if (groupName.length > VALIDATION.MAX_GROUP_NAME_LENGTH) { if (groupName.length > LIBSESSION_CONSTANTS.BASE_GROUP_MAX_NAME_LENGTH) {
onError(window.i18n('invalidGroupNameTooLong')); onError(window.i18n('invalidGroupNameTooLong'));
return false; return false;
} }
@ -191,7 +192,7 @@ export const OverlayClosedGroup = () => {
onValueChanged={setGroupName} onValueChanged={setGroupName}
onEnterPressed={onEnterPressed} onEnterPressed={onEnterPressed}
error={groupNameError} error={groupNameError}
maxLength={VALIDATION.MAX_GROUP_NAME_LENGTH} maxLength={LIBSESSION_CONSTANTS.BASE_GROUP_MAX_NAME_LENGTH}
textSize="md" textSize="md"
centerText={true} centerText={true}
monospaced={true} monospaced={true}

@ -71,7 +71,6 @@ export const CONVERSATION = {
export const MAX_ATTACHMENT_FILESIZE_BYTES = 10 * 1000 * 1000; export const MAX_ATTACHMENT_FILESIZE_BYTES = 10 * 1000 * 1000;
export const VALIDATION = { export const VALIDATION = {
MAX_GROUP_NAME_LENGTH: 30,
CLOSED_GROUP_SIZE_LIMIT: 100, CLOSED_GROUP_SIZE_LIMIT: 100,
}; };

Loading…
Cancel
Save