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

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

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

Loading…
Cancel
Save