diff --git a/app/components/edit_channel_info/index.js b/app/components/edit_channel_info/index.js index 88131056f..63f471da3 100644 --- a/app/components/edit_channel_info/index.js +++ b/app/components/edit_channel_info/index.js @@ -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); }; diff --git a/app/constants/view.js b/app/constants/view.js index 2312d5fc7..2daf50bff 100644 --- a/app/constants/view.js +++ b/app/constants/view.js @@ -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, diff --git a/app/screens/edit_channel/edit_channel.js b/app/screens/edit_channel/edit_channel.js index e07d08cb2..6801f9de6 100644 --- a/app/screens/edit_channel/edit_channel.js +++ b/app/screens/edit_channel/edit_channel.js @@ -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);