hotfix for invalid names
This commit is contained in:
parent
fcd71e0b79
commit
91f28d7be1
3 changed files with 8 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useEffect, Fragment } from 'react';
|
import React, { useEffect, Fragment } from 'react';
|
||||||
import { CHANNEL_NEW, CHANNEL_ANONYMOUS } from 'constants/claim';
|
import { CHANNEL_NEW, CHANNEL_ANONYMOUS } from 'constants/claim';
|
||||||
import { buildURI, isURIValid, THUMBNAIL_STATUSES } from 'lbry-redux';
|
import { buildURI, isURIValid, isNameValid, THUMBNAIL_STATUSES } from 'lbry-redux';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ChannelSection from 'component/selectChannel';
|
import ChannelSection from 'component/selectChannel';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
@ -77,7 +77,8 @@ function PublishForm(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
const formDisabled = (!filePath && !editingURI) || publishing;
|
const formDisabled = (!filePath && !editingURI) || publishing;
|
||||||
// If they are editing, they don't need a new file chosen
|
// If they are editing, they don't need a new file chosen
|
||||||
const formValidLessFile = name && title && bid && !(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
const formValidLessFile =
|
||||||
|
name && isNameValid(name, false) && title && bid && !(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
||||||
const formValid = editingURI && !filePath ? isStillEditing && formValidLessFile : formValidLessFile;
|
const formValid = editingURI && !filePath ? isStillEditing && formValidLessFile : formValidLessFile;
|
||||||
|
|
||||||
let submitLabel;
|
let submitLabel;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { THUMBNAIL_STATUSES } from 'lbry-redux';
|
import { THUMBNAIL_STATUSES, isNameValid } from 'lbry-redux';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
title: ?string,
|
title: ?string,
|
||||||
|
@ -21,6 +21,7 @@ function PublishFormErrors(props: Props) {
|
||||||
<div className="error-text">
|
<div className="error-text">
|
||||||
{!title && <div>{__('A title is required')}</div>}
|
{!title && <div>{__('A title is required')}</div>}
|
||||||
{!name && <div>{__('A URL is required')}</div>}
|
{!name && <div>{__('A URL is required')}</div>}
|
||||||
|
{!isNameValid(name, false) && __('LBRY names cannot contain spaces or reserved symbols ($#@;/"<>%{}|^~[]`)')}
|
||||||
{!bid && <div>{__('A deposit amount is required')}</div>}
|
{!bid && <div>{__('A deposit amount is required')}</div>}
|
||||||
{uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS && (
|
{uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS && (
|
||||||
<div>{__('Please wait for thumbnail to finish uploading')}</div>
|
<div>{__('Please wait for thumbnail to finish uploading')}</div>
|
||||||
|
|
|
@ -76,8 +76,8 @@ class ChannelSection extends React.PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let newChannelNameError;
|
let newChannelNameError;
|
||||||
if (newChannelName.length > 1 && !isNameValid(newChannelName.substr(1), false)) {
|
if (newChannelName.length > 0 && !isNameValid(newChannelName, false)) {
|
||||||
newChannelNameError = __('LBRY channel names must contain only letters, numbers and dashes.');
|
newChannelNameError = __('LBRY names cannot contain spaces or reserved symbols ($#@;/"<>%{}|^~[]`)');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -107,7 +107,7 @@ class ChannelSection extends React.PureComponent<Props, State> {
|
||||||
const { balance, createChannel, onChannelChange } = this.props;
|
const { balance, createChannel, onChannelChange } = this.props;
|
||||||
const { newChannelBid, newChannelName } = this.state;
|
const { newChannelBid, newChannelName } = this.state;
|
||||||
|
|
||||||
const channelName = `@${newChannelName}`;
|
const channelName = `@${newChannelName.trim()}`;
|
||||||
|
|
||||||
if (newChannelBid > balance) {
|
if (newChannelBid > balance) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue