add 'chn' to the list of permitted topic name prefixes

This commit is contained in:
or-else
2021-03-15 16:47:31 -07:00
parent 6cd180771a
commit e703490a1e
5 changed files with 14 additions and 9 deletions
+3 -2
View File
@@ -35,8 +35,9 @@ class NewTopicById extends React.PureComponent {
handleSubmit(e) {
e.preventDefault();
if (this.state.groupId) {
var name = this.state.groupId.trim();
if (name.length > 3 && (name.substr(0, 3) == 'usr' || name.substr(0, 3) == 'grp')) {
const name = this.state.groupId.trim();
const prefix = name.substr(0, 3);
if (name.length > 3 && ['usr', 'grp', 'chn'].includes(prefix)) {
this.props.onSubmit(name);
} else {
this.props.onError(this.props.intl.formatMessage(messages.invalid_id), 'err');