Create Group: enforce max limit on description and name
This commit is contained in:
parent
65d1c66aad
commit
63df638630
2 changed files with 8 additions and 2 deletions
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'soapbox/actions/groups';
|
} from 'soapbox/actions/groups';
|
||||||
import Icon from 'soapbox/components/icon';
|
import Icon from 'soapbox/components/icon';
|
||||||
import { Avatar, Form, FormGroup, HStack, Input, Text, Textarea } from 'soapbox/components/ui';
|
import { Avatar, Form, FormGroup, HStack, Input, Text, Textarea } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useInstance } from 'soapbox/hooks';
|
||||||
import { isDefaultAvatar, isDefaultHeader } from 'soapbox/utils/accounts';
|
import { isDefaultAvatar, isDefaultHeader } from 'soapbox/utils/accounts';
|
||||||
import resizeImage from 'soapbox/utils/resize-image';
|
import resizeImage from 'soapbox/utils/resize-image';
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ const AvatarPicker: React.FC<IMediaInput> = ({ src, onChange, accept, disabled }
|
||||||
const DetailsStep = () => {
|
const DetailsStep = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
const instance = useInstance();
|
||||||
|
|
||||||
const groupId = useAppSelector((state) => state.group_editor.groupId);
|
const groupId = useAppSelector((state) => state.group_editor.groupId);
|
||||||
const isUploading = useAppSelector((state) => state.group_editor.isUploading);
|
const isUploading = useAppSelector((state) => state.group_editor.isUploading);
|
||||||
|
@ -146,7 +147,6 @@ const DetailsStep = () => {
|
||||||
});
|
});
|
||||||
}, [groupId]);
|
}, [groupId]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form>
|
||||||
<div className='relative mb-12 flex'>
|
<div className='relative mb-12 flex'>
|
||||||
|
@ -161,6 +161,7 @@ const DetailsStep = () => {
|
||||||
placeholder={intl.formatMessage(messages.groupNamePlaceholder)}
|
placeholder={intl.formatMessage(messages.groupNamePlaceholder)}
|
||||||
value={name}
|
value={name}
|
||||||
onChange={onChangeName}
|
onChange={onChangeName}
|
||||||
|
maxLength={Number(instance.configuration.getIn(['groups', 'max_characters_name']))}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -171,6 +172,7 @@ const DetailsStep = () => {
|
||||||
placeholder={intl.formatMessage(messages.groupDescriptionPlaceholder)}
|
placeholder={intl.formatMessage(messages.groupDescriptionPlaceholder)}
|
||||||
value={description}
|
value={description}
|
||||||
onChange={onChangeDescription}
|
onChange={onChangeDescription}
|
||||||
|
maxLength={Number(instance.configuration.getIn(['groups', 'max_characters_description']))}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
@ -35,6 +35,10 @@ export const InstanceRecord = ImmutableRecord({
|
||||||
max_characters: 500,
|
max_characters: 500,
|
||||||
max_media_attachments: 4,
|
max_media_attachments: 4,
|
||||||
}),
|
}),
|
||||||
|
groups: ImmutableMap<string, number>({
|
||||||
|
max_characters_name: 50,
|
||||||
|
max_characters_description: 100,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
description: '',
|
description: '',
|
||||||
description_limit: 1500,
|
description_limit: 1500,
|
||||||
|
|
Loading…
Reference in a new issue