Add webapp/utils/url.jsx (#5285)
webapp/utils/utils.jsx got big and that caused a potential circular dependency with webapp/stores/team_store.jsx. This change solves the issue by introducing webapp/utils/url.jsx and moving URL-related functions, which is not likely to depend on actions and stores, from webapp/utils/utils.jsx.
Этот коммит содержится в:
коммит произвёл
enahum
родитель
9bdea0de80
Коммит
68a05653ea
@@ -3,8 +3,8 @@
|
||||
|
||||
import {track} from 'actions/analytics_actions.jsx';
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
import {cleanUpUrlable} from 'utils/url.jsx';
|
||||
|
||||
import logoImage from 'images/logo.png';
|
||||
|
||||
@@ -50,7 +50,7 @@ export default class TeamSignupDisplayNamePage extends React.Component {
|
||||
|
||||
this.props.state.wizard = 'team_url';
|
||||
this.props.state.team.display_name = displayName;
|
||||
this.props.state.team.name = Utils.cleanUpUrlable(displayName);
|
||||
this.props.state.team.name = cleanUpUrlable(displayName);
|
||||
this.props.updateParent(this.props.state);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import {checkIfTeamExists, createTeam} from 'actions/team_actions.jsx';
|
||||
import {track} from 'actions/analytics_actions.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
import * as URL from 'utils/url.jsx';
|
||||
|
||||
import logoImage from 'images/logo.png';
|
||||
|
||||
@@ -38,7 +37,7 @@ export default class TeamUrl extends React.Component {
|
||||
e.preventDefault();
|
||||
|
||||
const name = ReactDOM.findDOMNode(this.refs.name).value.trim();
|
||||
const cleanedName = Utils.cleanUpUrlable(name);
|
||||
const cleanedName = URL.cleanUpUrlable(name);
|
||||
const urlRegex = /^[a-z]+([a-z\-0-9]+|(__)?)[a-z0-9]+$/g;
|
||||
|
||||
if (!name) {
|
||||
@@ -136,7 +135,7 @@ export default class TeamUrl extends React.Component {
|
||||
nameDivClass += ' has-error';
|
||||
}
|
||||
|
||||
const title = `${Utils.getSiteURL()}/`;
|
||||
const title = `${URL.getSiteURL()}/`;
|
||||
const urlTooltip = (
|
||||
<Tooltip id='urlTooltip'>{title}</Tooltip>
|
||||
);
|
||||
|
||||
Ссылка в новой задаче
Block a user