From 68a05653ea6f2588a27c8ce523b0d213e48f6480 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Wed, 8 Feb 2017 00:20:01 +0900 Subject: 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. --- webapp/components/create_team/components/display_name.jsx | 4 ++-- webapp/components/create_team/components/team_url.jsx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'webapp/components/create_team') diff --git a/webapp/components/create_team/components/display_name.jsx b/webapp/components/create_team/components/display_name.jsx index 67805a040..29077bd24 100644 --- a/webapp/components/create_team/components/display_name.jsx +++ b/webapp/components/create_team/components/display_name.jsx @@ -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); } diff --git a/webapp/components/create_team/components/team_url.jsx b/webapp/components/create_team/components/team_url.jsx index ccf5d63dc..4a063d145 100644 --- a/webapp/components/create_team/components/team_url.jsx +++ b/webapp/components/create_team/components/team_url.jsx @@ -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 = ( {title} ); -- cgit v1.2.3-1-g7c22