MM-41909: Allow 1 char channel name (#6093)

* [MM-41909] Reduce displayname character limit to 1

* [MM-41909] Implement channel url min length check

* Use constant per comment

Co-authored-by: Kevin Jiang <>
This commit is contained in:
Kevin Sicong Jiang 2022-04-01 01:19:12 +13:00 committed by GitHub
parent 2a56b6810b
commit 0ca5627d78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -21,6 +21,7 @@ import FormattedText from '@components/formatted_text';
import Loading from '@components/loading';
import StatusBar from '@components/status_bar';
import TextInputWithLocalizedPlaceholder from '@components/text_input_with_localized_placeholder';
import {ViewTypes} from '@constants';
import DEVICE from '@constants/device';
import {General} from '@mm-redux/constants';
import {t} from '@utils/i18n';
@ -130,7 +131,7 @@ export default class EditChannelInfo extends PureComponent {
return;
}
const displayNameExists = displayName && displayName.length >= 2;
const displayNameExists = displayName && displayName.length >= ViewTypes.MIN_CHANNELNAME_LENGTH;
this.props.enableRightButton(displayNameExists);
};

View file

@ -129,7 +129,7 @@ export default {
FEATURE_TOGGLE_PREFIX: 'feature_enabled_',
EMBED_PREVIEW: 'embed_preview',
LINK_PREVIEW_DISPLAY: 'link_previews',
MIN_CHANNELNAME_LENGTH: 2,
MIN_CHANNELNAME_LENGTH: 1,
MAX_CHANNELNAME_LENGTH: 64,
ANDROID_TOP_LANDSCAPE: 46,
ANDROID_TOP_PORTRAIT: 56,

View file

@ -226,6 +226,11 @@ export default class EditChannel extends PureComponent {
messages.name_maxLength,
{maxLength: ViewTypes.MAX_CHANNELNAME_LENGTH},
)};
} else if (channelURL.length < ViewTypes.MIN_CHANNELNAME_LENGTH) {
return {error: formatMessage(
messages.name_minLength,
{maxLength: ViewTypes.MIN_CHANNELNAME_LENGTH},
)};
}
const cleanedName = cleanUpUrlable(channelURL);