summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-05-26 09:46:18 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2016-05-26 09:46:18 -0400
commit6fecfcc7ca9f7cf29b4cf87ebeb63b09df70a8c7 (patch)
treed0d8d9833156f2a21f37a1ff746acd18342d3ebe /webapp
parent9c0caaa76505d4d473f987298acace4f198eb447 (diff)
downloadchat-6fecfcc7ca9f7cf29b4cf87ebeb63b09df70a8c7.tar.gz
chat-6fecfcc7ca9f7cf29b4cf87ebeb63b09df70a8c7.tar.bz2
chat-6fecfcc7ca9f7cf29b4cf87ebeb63b09df70a8c7.zip
Refactor login, claim and create_team into views and add actions (#3110)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/analytics_actions.jsx12
-rw-r--r--webapp/actions/global_actions.jsx (renamed from webapp/action_creators/global_actions.jsx)4
-rw-r--r--webapp/actions/team_actions.jsx38
-rw-r--r--webapp/actions/websocket_actions.jsx (renamed from webapp/action_creators/websocket_actions.jsx)2
-rw-r--r--webapp/components/admin_console/admin_navbar_dropdown.jsx2
-rw-r--r--webapp/components/claim/claim_controller.jsx (renamed from webapp/components/claim/claim.jsx)6
-rw-r--r--webapp/components/create_comment.jsx2
-rw-r--r--webapp/components/create_post.jsx2
-rw-r--r--webapp/components/create_team/components/display_name.jsx38
-rw-r--r--webapp/components/create_team/components/team_url.jsx95
-rw-r--r--webapp/components/create_team/create_team_controller.jsx (renamed from webapp/components/create_team/create_team.jsx)4
-rw-r--r--webapp/components/edit_post_modal.jsx2
-rw-r--r--webapp/components/invite_member_modal.jsx2
-rw-r--r--webapp/components/logged_in.jsx2
-rw-r--r--webapp/components/login/login_controller.jsx (renamed from webapp/components/login/login.jsx)8
-rw-r--r--webapp/components/more_channels.jsx2
-rw-r--r--webapp/components/more_direct_channels.jsx2
-rw-r--r--webapp/components/navbar.jsx4
-rw-r--r--webapp/components/navbar_dropdown.jsx2
-rw-r--r--webapp/components/needs_team.jsx2
-rw-r--r--webapp/components/post_focus_view.jsx2
-rw-r--r--webapp/components/post_info.jsx2
-rw-r--r--webapp/components/posts_view.jsx2
-rw-r--r--webapp/components/posts_view_container.jsx2
-rw-r--r--webapp/components/rhs_comment.jsx2
-rw-r--r--webapp/components/rhs_header_post.jsx2
-rw-r--r--webapp/components/rhs_root_post.jsx2
-rw-r--r--webapp/components/root.jsx2
-rw-r--r--webapp/components/search_results_item.jsx2
-rw-r--r--webapp/components/select_team/select_team.jsx2
-rw-r--r--webapp/components/sidebar_right_menu.jsx2
-rw-r--r--webapp/components/signup_user_complete.jsx13
-rw-r--r--webapp/components/suggestion/suggestion_box.jsx2
-rw-r--r--webapp/components/suggestion/suggestion_list.jsx2
-rw-r--r--webapp/components/tutorial/tutorial_intro_screens.jsx2
-rw-r--r--webapp/components/user_settings/manage_languages.jsx2
-rw-r--r--webapp/components/user_settings/user_settings_developer.jsx4
-rw-r--r--webapp/components/view_image.jsx2
-rw-r--r--webapp/root.jsx16
-rw-r--r--webapp/stores/team_store.jsx5
-rw-r--r--webapp/utils/async_client.jsx2
-rw-r--r--webapp/utils/channel_intro_messages.jsx2
-rw-r--r--webapp/utils/constants.jsx3
-rw-r--r--webapp/utils/web_client.jsx2
44 files changed, 162 insertions, 148 deletions
diff --git a/webapp/actions/analytics_actions.jsx b/webapp/actions/analytics_actions.jsx
new file mode 100644
index 000000000..05e4eeee2
--- /dev/null
+++ b/webapp/actions/analytics_actions.jsx
@@ -0,0 +1,12 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import Client from 'utils/web_client.jsx';
+
+export function track(category, action, label, property, value) {
+ Client.track(category, action, label, property, value);
+}
+
+export function trackPage() {
+ Client.trackPage();
+}
diff --git a/webapp/action_creators/global_actions.jsx b/webapp/actions/global_actions.jsx
index 6bb0c1732..2e2b1b247 100644
--- a/webapp/action_creators/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -18,6 +18,8 @@ import * as Utils from 'utils/utils.jsx';
import * as Websockets from './websocket_actions.jsx';
import * as I18n from 'i18n/i18n.jsx';
+import {trackPage} from 'actions/analytics_actions.jsx';
+
import {browserHistory} from 'react-router';
import en from 'i18n/en.json';
@@ -40,7 +42,7 @@ export function emitChannelClickEvent(channel) {
AsyncClient.getChannelExtraInfo(chan.id);
AsyncClient.updateLastViewedAt(chan.id);
AsyncClient.getPosts(chan.id);
- Client.trackPage();
+ trackPage();
AppDispatcher.handleViewAction({
type: ActionTypes.CLICK_CHANNEL,
diff --git a/webapp/actions/team_actions.jsx b/webapp/actions/team_actions.jsx
new file mode 100644
index 000000000..2408e55fd
--- /dev/null
+++ b/webapp/actions/team_actions.jsx
@@ -0,0 +1,38 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import UserStore from 'stores/user_store.jsx';
+
+import Constants from 'utils/constants.jsx';
+const ActionTypes = Constants.ActionTypes;
+
+import * as AsyncClient from 'utils/async_client.jsx';
+import Client from 'utils/web_client.jsx';
+import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
+
+import {browserHistory} from 'react-router';
+
+export function checkIfTeamExists(teamName, onSuccess, onError) {
+ Client.findTeamByName(teamName, onSuccess, onError);
+}
+
+export function createTeam(team, onSuccess, onError) {
+ Client.createTeam(team,
+ (rteam) => {
+ AsyncClient.getDirectProfiles();
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.CREATED_TEAM,
+ team: rteam,
+ member: {team_id: rteam.id, user_id: UserStore.getCurrentId(), roles: 'admin'}
+ });
+
+ browserHistory.push('/' + rteam.name + '/channels/town-square');
+
+ if (onSuccess) {
+ onSuccess(rteam);
+ }
+ },
+ onError
+ );
+}
diff --git a/webapp/action_creators/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx
index b208b4d33..e317b8db0 100644
--- a/webapp/action_creators/websocket_actions.jsx
+++ b/webapp/actions/websocket_actions.jsx
@@ -13,7 +13,7 @@ import NotificationStore from 'stores/notification_store.jsx'; //eslint-disable-
import Client from 'utils/web_client.jsx';
import * as Utils from 'utils/utils.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
const SocketEvents = Constants.SocketEvents;
diff --git a/webapp/components/admin_console/admin_navbar_dropdown.jsx b/webapp/components/admin_console/admin_navbar_dropdown.jsx
index dc0a987d3..65a76a517 100644
--- a/webapp/components/admin_console/admin_navbar_dropdown.jsx
+++ b/webapp/components/admin_console/admin_navbar_dropdown.jsx
@@ -6,7 +6,7 @@ import ReactDOM from 'react-dom';
import TeamStore from 'stores/team_store.jsx';
import Constants from 'utils/constants.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
diff --git a/webapp/components/claim/claim.jsx b/webapp/components/claim/claim_controller.jsx
index 0197e1677..dbb944bb9 100644
--- a/webapp/components/claim/claim.jsx
+++ b/webapp/components/claim/claim_controller.jsx
@@ -7,7 +7,7 @@ import {Link} from 'react-router';
import logoImage from 'images/logo.png';
-export default class Claim extends React.Component {
+export default class ClaimController extends React.Component {
constructor(props) {
super(props);
@@ -51,9 +51,9 @@ export default class Claim extends React.Component {
}
}
-Claim.defaultProps = {
+ClaimController.defaultProps = {
};
-Claim.propTypes = {
+ClaimController.propTypes = {
location: React.PropTypes.object.isRequired,
children: React.PropTypes.node
};
diff --git a/webapp/components/create_comment.jsx b/webapp/components/create_comment.jsx
index 771a8ef3a..814cffef9 100644
--- a/webapp/components/create_comment.jsx
+++ b/webapp/components/create_comment.jsx
@@ -16,7 +16,7 @@ import MsgTyping from './msg_typing.jsx';
import FileUpload from './file_upload.jsx';
import FilePreview from './file_preview.jsx';
import * as Utils from 'utils/utils.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx
index 3f319bb58..14717b41e 100644
--- a/webapp/components/create_post.jsx
+++ b/webapp/components/create_post.jsx
@@ -10,7 +10,7 @@ import PostDeletedModal from './post_deleted_modal.jsx';
import TutorialTip from './tutorial/tutorial_tip.jsx';
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Client from 'utils/web_client.jsx';
import * as Utils from 'utils/utils.jsx';
diff --git a/webapp/components/create_team/components/display_name.jsx b/webapp/components/create_team/components/display_name.jsx
index e8f1717bb..e6dcd221a 100644
--- a/webapp/components/create_team/components/display_name.jsx
+++ b/webapp/components/create_team/components/display_name.jsx
@@ -1,29 +1,19 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import ReactDOM from 'react-dom';
-import * as utils from 'utils/utils.jsx';
-import Client from 'utils/web_client.jsx';
-import {Link} from 'react-router';
+import {track} from 'actions/analytics_actions.jsx';
-import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl';
+import * as Utils from 'utils/utils.jsx';
+import Constants from 'utils/constants.jsx';
import logoImage from 'images/logo.png';
-const holders = defineMessages({
- required: {
- id: 'create_team.display_name.required',
- defaultMessage: 'This field is required'
- },
- charLength: {
- id: 'create_team.display_name.charLength',
- defaultMessage: 'Name must be 4 or more characters up to a maximum of 15'
- }
-});
-
import React from 'react';
+import ReactDOM from 'react-dom';
+import {Link} from 'react-router';
+import {FormattedMessage} from 'react-intl';
-class TeamSignupDisplayNamePage extends React.Component {
+export default class TeamSignupDisplayNamePage extends React.Component {
constructor(props) {
super(props);
@@ -35,19 +25,18 @@ class TeamSignupDisplayNamePage extends React.Component {
submitNext(e) {
e.preventDefault();
- const {formatMessage} = this.props.intl;
var displayName = ReactDOM.findDOMNode(this.refs.name).value.trim();
if (!displayName) {
- this.setState({nameError: formatMessage(holders.required)});
+ this.setState({nameError: Utils.localizeMessage('create_team.display_name.required', 'This field is required')});
return;
- } else if (displayName.length < 4 || displayName.length > 15) {
- this.setState({nameError: formatMessage(holders.charLength)});
+ } else if (displayName.length < Constants.MIN_TEAMNAME_LENGTH || displayName.length > Constants.MAX_TEAMNAME_LENGTH) {
+ this.setState({nameError: Utils.localizeMessage('create_team.display_name.charLength', 'Name must be 4 or more characters up to a maximum of 15')});
return;
}
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 = Utils.cleanUpUrlable(displayName);
this.props.updateParent(this.props.state);
}
@@ -57,7 +46,7 @@ class TeamSignupDisplayNamePage extends React.Component {
}
render() {
- Client.track('signup', 'signup_team_02_name');
+ track('signup', 'signup_team_02_name');
var nameError = null;
var nameDivClass = 'form-group';
@@ -128,9 +117,6 @@ class TeamSignupDisplayNamePage extends React.Component {
}
TeamSignupDisplayNamePage.propTypes = {
- intl: intlShape.isRequired,
state: React.PropTypes.object,
updateParent: React.PropTypes.func
};
-
-export default injectIntl(TeamSignupDisplayNamePage);
diff --git a/webapp/components/create_team/components/team_url.jsx b/webapp/components/create_team/components/team_url.jsx
index 34e696938..b6c634816 100644
--- a/webapp/components/create_team/components/team_url.jsx
+++ b/webapp/components/create_team/components/team_url.jsx
@@ -2,45 +2,20 @@
// See License.txt for license information.
import $ from 'jquery';
-import ReactDOM from 'react-dom';
+
import * as Utils from 'utils/utils.jsx';
-import Client from 'utils/web_client.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
-import TeamStore from 'stores/team_store.jsx';
-import UserStore from 'stores/user_store.jsx';
-import Constants from 'utils/constants.jsx';
-import {browserHistory} from 'react-router';
-import {injectIntl, intlShape, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'react-intl';
+import {checkIfTeamExists, createTeam} from 'actions/team_actions.jsx';
+import {track} from 'actions/analytics_actions.jsx';
+import Constants from 'utils/constants.jsx';
import logoImage from 'images/logo.png';
-const holders = defineMessages({
- required: {
- id: 'create_team.team_url.required',
- defaultMessage: 'This field is required'
- },
- regex: {
- id: 'create_team.team_url.regex',
- defaultMessage: "Use only lower case letters, numbers and dashes. Must start with a letter and can't end in a dash."
- },
- charLength: {
- id: 'create_team.team_url.charLength',
- defaultMessage: 'Name must be 4 or more characters up to a maximum of 15'
- },
- taken: {
- id: 'create_team.team_url.taken',
- defaultMessage: 'URL is taken or contains a reserved word'
- },
- unavailable: {
- id: 'create_team.team_url.unavailable',
- defaultMessage: 'This URL is unavailable. Please try another.'
- }
-});
-
import React from 'react';
+import ReactDOM from 'react-dom';
+import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
-class TeamUrl extends React.Component {
+export default class TeamUrl extends React.Component {
constructor(props) {
super(props);
@@ -58,10 +33,9 @@ class TeamUrl extends React.Component {
submitNext(e) {
e.preventDefault();
- const {formatMessage} = this.props.intl;
const name = ReactDOM.findDOMNode(this.refs.name).value.trim();
if (!name) {
- this.setState({nameError: formatMessage(holders.required)});
+ this.setState({nameError: Utils.localizeMessage('create_team.team_url.required', 'This field is required')});
return;
}
@@ -69,17 +43,17 @@ class TeamUrl extends React.Component {
const urlRegex = /^[a-z]+([a-z\-0-9]+|(__)?)[a-z0-9]+$/g;
if (cleanedName !== name || !urlRegex.test(name)) {
- this.setState({nameError: formatMessage(holders.regex)});
+ this.setState({nameError: Utils.localizeMessage('create_team.team_url.regex', "Use only lower case letters, numbers and dashes. Must start with a letter and can't end in a dash.")});
return;
- } else if (cleanedName.length < 4 || cleanedName.length > 15) {
- this.setState({nameError: formatMessage(holders.charLength)});
+ } else if (cleanedName.length < Constants.MIN_TEAMNAME_LENGTH || cleanedName.length > Constants.MAX_TEAMNAME_LENGTH) {
+ this.setState({nameError: Utils.localizeMessage('create_team.team_url.charLength', 'Name must be 4 or more characters up to a maximum of 15')});
return;
}
if (global.window.mm_config.RestrictTeamNames === 'true') {
for (let index = 0; index < Constants.RESERVED_TEAM_NAMES.length; index++) {
if (cleanedName.indexOf(Constants.RESERVED_TEAM_NAMES[index]) === 0) {
- this.setState({nameError: formatMessage(holders.taken)});
+ this.setState({nameError: Utils.localizeMessage('create_team.team_url.taken', 'URL is taken or contains a reserved word')});
return;
}
}
@@ -90,30 +64,24 @@ class TeamUrl extends React.Component {
teamSignup.team.type = 'O';
teamSignup.team.name = name;
- Client.findTeamByName(name,
- (findTeam) => {
- if (findTeam) {
- this.setState({nameError: formatMessage(holders.unavailable)});
- $('#finish-button').button('reset');
- } else {
- Client.createTeam(teamSignup.team,
- (team) => {
- Client.track('signup', 'signup_team_08_complete');
- $('#sign-up-button').button('reset');
- AsyncClient.getDirectProfiles();
- TeamStore.saveTeam(team);
- TeamStore.appendTeamMember({team_id: team.id, user_id: UserStore.getCurrentId(), roles: 'admin'});
- TeamStore.emitChange();
- browserHistory.push('/' + team.name + '/channels/town-square');
- },
- (err) => {
- this.setState({nameError: err.message});
- $('#finish-button').button('reset');
- }
- );
-
+ checkIfTeamExists(name,
+ (foundTeam) => {
+ if (foundTeam) {
+ this.setState({nameError: Utils.localizeMessage('create_team.team_url.unavailable', 'This URL is unavailable. Please try another.')});
$('#finish-button').button('reset');
+ return;
}
+
+ createTeam(teamSignup.team,
+ () => {
+ track('signup', 'signup_team_08_complete');
+ $('#sign-up-button').button('reset');
+ },
+ (err) => {
+ this.setState({nameError: err.message});
+ $('#finish-button').button('reset');
+ }
+ );
},
(err) => {
this.setState({nameError: err.message});
@@ -121,15 +89,17 @@ class TeamUrl extends React.Component {
}
);
}
+
handleFocus(e) {
e.preventDefault();
e.currentTarget.select();
}
+
render() {
$('body').tooltip({selector: '[data-toggle=tooltip]', trigger: 'hover click'});
- Client.track('signup', 'signup_team_03_url');
+ track('signup', 'signup_team_03_url');
let nameError = null;
let nameDivClass = 'form-group';
@@ -223,9 +193,6 @@ class TeamUrl extends React.Component {
}
TeamUrl.propTypes = {
- intl: intlShape.isRequired,
state: React.PropTypes.object,
updateParent: React.PropTypes.func
};
-
-export default injectIntl(TeamUrl);
diff --git a/webapp/components/create_team/create_team.jsx b/webapp/components/create_team/create_team_controller.jsx
index 8a119a122..ad2a008bd 100644
--- a/webapp/components/create_team/create_team.jsx
+++ b/webapp/components/create_team/create_team_controller.jsx
@@ -8,7 +8,7 @@ import {browserHistory, Link} from 'react-router';
import React from 'react';
-export default class CreateTeam extends React.Component {
+export default class CreateTeamController extends React.Component {
constructor(props) {
super(props);
@@ -67,6 +67,6 @@ export default class CreateTeam extends React.Component {
}
}
-CreateTeam.propTypes = {
+CreateTeamController.propTypes = {
children: React.PropTypes.node
};
diff --git a/webapp/components/edit_post_modal.jsx b/webapp/components/edit_post_modal.jsx
index bc67a34f9..92b16f925 100644
--- a/webapp/components/edit_post_modal.jsx
+++ b/webapp/components/edit_post_modal.jsx
@@ -5,7 +5,7 @@ import $ from 'jquery';
import ReactDOM from 'react-dom';
import Client from 'utils/web_client.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Textbox from './textbox.jsx';
import BrowserStore from 'stores/browser_store.jsx';
import PostStore from 'stores/post_store.jsx';
diff --git a/webapp/components/invite_member_modal.jsx b/webapp/components/invite_member_modal.jsx
index 205988dc8..96a9eb75d 100644
--- a/webapp/components/invite_member_modal.jsx
+++ b/webapp/components/invite_member_modal.jsx
@@ -6,7 +6,7 @@ import * as utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
import Client from 'utils/web_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import ModalStore from 'stores/modal_store.jsx';
import UserStore from 'stores/user_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
diff --git a/webapp/components/logged_in.jsx b/webapp/components/logged_in.jsx
index 9f1fac6bc..0c37d62cb 100644
--- a/webapp/components/logged_in.jsx
+++ b/webapp/components/logged_in.jsx
@@ -8,7 +8,7 @@ import UserStore from 'stores/user_store.jsx';
import BrowserStore from 'stores/browser_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import * as Utils from 'utils/utils.jsx';
-import * as Websockets from 'action_creators/websocket_actions.jsx';
+import * as Websockets from 'actions/websocket_actions.jsx';
import Constants from 'utils/constants.jsx';
import {browserHistory} from 'react-router';
diff --git a/webapp/components/login/login.jsx b/webapp/components/login/login_controller.jsx
index f39e99951..c4a76f912 100644
--- a/webapp/components/login/login.jsx
+++ b/webapp/components/login/login_controller.jsx
@@ -5,7 +5,7 @@ import LoginMfa from './components/login_mfa.jsx';
import ErrorBar from 'components/error_bar.jsx';
import FormError from 'components/form_error.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import UserStore from 'stores/user_store.jsx';
import Client from 'utils/web_client.jsx';
@@ -21,7 +21,7 @@ import {browserHistory, Link} from 'react-router';
import React from 'react';
import logoImage from 'images/logo.png';
-export default class Login extends React.Component {
+export default class LoginController extends React.Component {
constructor(props) {
super(props);
@@ -446,8 +446,8 @@ export default class Login extends React.Component {
}
}
-Login.defaultProps = {
+LoginController.defaultProps = {
};
-Login.propTypes = {
+LoginController.propTypes = {
params: React.PropTypes.object.isRequired
};
diff --git a/webapp/components/more_channels.jsx b/webapp/components/more_channels.jsx
index 087db68e6..34cad32d2 100644
--- a/webapp/components/more_channels.jsx
+++ b/webapp/components/more_channels.jsx
@@ -9,7 +9,7 @@ import ChannelStore from 'stores/channel_store.jsx';
import * as Utils from 'utils/utils.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
diff --git a/webapp/components/more_direct_channels.jsx b/webapp/components/more_direct_channels.jsx
index 2895047b5..de61bcf98 100644
--- a/webapp/components/more_direct_channels.jsx
+++ b/webapp/components/more_direct_channels.jsx
@@ -6,7 +6,7 @@ import FilteredUserList from './filtered_user_list.jsx';
import UserStore from 'stores/user_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import * as Utils from 'utils/utils.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index c37c982d9..d4968986e 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -35,7 +35,7 @@ import {Link, browserHistory} from 'react-router';
import React from 'react';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
export default class Navbar extends React.Component {
constructor(props) {
@@ -687,4 +687,4 @@ Navbar.defaultProps = {
};
Navbar.propTypes = {
teamDisplayName: React.PropTypes.string
-}; \ No newline at end of file
+};
diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx
index 2c67bbdf3..87df3848d 100644
--- a/webapp/components/navbar_dropdown.jsx
+++ b/webapp/components/navbar_dropdown.jsx
@@ -4,7 +4,7 @@
import $ from 'jquery';
import ReactDOM from 'react-dom';
import * as Utils from 'utils/utils.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
diff --git a/webapp/components/needs_team.jsx b/webapp/components/needs_team.jsx
index c2f450f98..955758237 100644
--- a/webapp/components/needs_team.jsx
+++ b/webapp/components/needs_team.jsx
@@ -12,7 +12,7 @@ import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
const TutorialSteps = Constants.TutorialSteps;
const Preferences = Constants.Preferences;
diff --git a/webapp/components/post_focus_view.jsx b/webapp/components/post_focus_view.jsx
index 0655a9916..30a2f9d72 100644
--- a/webapp/components/post_focus_view.jsx
+++ b/webapp/components/post_focus_view.jsx
@@ -5,7 +5,7 @@ import PostsView from './posts_view.jsx';
import PostStore from 'stores/post_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import React from 'react';
diff --git a/webapp/components/post_info.jsx b/webapp/components/post_info.jsx
index e4ac39447..e3b80e45c 100644
--- a/webapp/components/post_info.jsx
+++ b/webapp/components/post_info.jsx
@@ -4,7 +4,7 @@
import $ from 'jquery';
import * as Utils from 'utils/utils.jsx';
import TimeSince from './time_since.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
diff --git a/webapp/components/posts_view.jsx b/webapp/components/posts_view.jsx
index 74c249356..64da4e67c 100644
--- a/webapp/components/posts_view.jsx
+++ b/webapp/components/posts_view.jsx
@@ -6,7 +6,7 @@ import $ from 'jquery';
import Post from './post.jsx';
import FloatingTimestamp from './floating_timestamp.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import UserStore from 'stores/user_store.jsx';
diff --git a/webapp/components/posts_view_container.jsx b/webapp/components/posts_view_container.jsx
index d1d8a2093..3f8a44cc3 100644
--- a/webapp/components/posts_view_container.jsx
+++ b/webapp/components/posts_view_container.jsx
@@ -9,7 +9,7 @@ import LoadingScreen from './loading_screen.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import PostStore from 'stores/post_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/rhs_comment.jsx b/webapp/components/rhs_comment.jsx
index e25e3b524..17f83170d 100644
--- a/webapp/components/rhs_comment.jsx
+++ b/webapp/components/rhs_comment.jsx
@@ -8,7 +8,7 @@ import PendingPostActions from './pending_post_actions.jsx';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import * as TextFormatting from 'utils/text_formatting.jsx';
import * as Utils from 'utils/utils.jsx';
diff --git a/webapp/components/rhs_header_post.jsx b/webapp/components/rhs_header_post.jsx
index 493040800..6e0d9276e 100644
--- a/webapp/components/rhs_header_post.jsx
+++ b/webapp/components/rhs_header_post.jsx
@@ -3,7 +3,7 @@
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import Constants from 'utils/constants.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx
index 5938d672b..02fc4fc59 100644
--- a/webapp/components/rhs_root_post.jsx
+++ b/webapp/components/rhs_root_post.jsx
@@ -9,7 +9,7 @@ import * as TextFormatting from 'utils/text_formatting.jsx';
import * as Utils from 'utils/utils.jsx';
import FileAttachmentList from './file_attachment_list.jsx';
import PostBodyAdditionalContent from './post_body_additional_content.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx
index 0adbc7f04..f4656d45f 100644
--- a/webapp/components/root.jsx
+++ b/webapp/components/root.jsx
@@ -4,7 +4,7 @@
//import $ from 'jquery';
//import Client from 'utils/web_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import LocalizationStore from 'stores/localization_store.jsx';
import {IntlProvider} from 'react-intl';
diff --git a/webapp/components/search_results_item.jsx b/webapp/components/search_results_item.jsx
index 0c25e23bc..64413a044 100644
--- a/webapp/components/search_results_item.jsx
+++ b/webapp/components/search_results_item.jsx
@@ -6,7 +6,7 @@ import UserProfile from './user_profile.jsx';
import UserStore from 'stores/user_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import * as TextFormatting from 'utils/text_formatting.jsx';
import * as Utils from 'utils/utils.jsx';
diff --git a/webapp/components/select_team/select_team.jsx b/webapp/components/select_team/select_team.jsx
index 45a708d8c..a04961d5b 100644
--- a/webapp/components/select_team/select_team.jsx
+++ b/webapp/components/select_team/select_team.jsx
@@ -7,7 +7,7 @@ import * as Utils from 'utils/utils.jsx';
import ErrorBar from 'components/error_bar.jsx';
import LoadingScreen from 'components/loading_screen.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {Link} from 'react-router';
diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx
index 09e8dff46..b24b8e4fb 100644
--- a/webapp/components/sidebar_right_menu.jsx
+++ b/webapp/components/sidebar_right_menu.jsx
@@ -10,7 +10,7 @@ import UserStore from 'stores/user_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/signup_user_complete.jsx b/webapp/components/signup_user_complete.jsx
index 682d300cf..ad8b94722 100644
--- a/webapp/components/signup_user_complete.jsx
+++ b/webapp/components/signup_user_complete.jsx
@@ -3,7 +3,9 @@
import FormError from 'components/form_error.jsx';
import LoadingScreen from 'components/loading_screen.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+
+import * as GlobalActions from 'actions/global_actions.jsx';
+import {track} from 'actions/analytics_actions.jsx';
import BrowserStore from 'stores/browser_store.jsx';
import UserStore from 'stores/user_store.jsx';
@@ -12,11 +14,10 @@ import * as Utils from 'utils/utils.jsx';
import Client from 'utils/web_client.jsx';
import Constants from 'utils/constants.jsx';
-import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
-import {browserHistory, Link} from 'react-router';
-
import React from 'react';
import ReactDOM from 'react-dom';
+import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
+import {browserHistory, Link} from 'react-router';
import logoImage from 'images/logo.png';
@@ -199,7 +200,7 @@ export default class SignupUserComplete extends React.Component {
}
handleUserCreated(user, data) {
- Client.track('signup', 'signup_user_02_complete');
+ track('signup', 'signup_user_02_complete');
Client.loginById(
data.id,
user.password,
@@ -405,7 +406,7 @@ export default class SignupUserComplete extends React.Component {
}
render() {
- Client.track('signup', 'signup_user_01_welcome');
+ track('signup', 'signup_user_01_welcome');
// If we have been used then just display a message
if (this.state.usedBefore) {
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx
index 998c17340..86d349a1a 100644
--- a/webapp/components/suggestion/suggestion_box.jsx
+++ b/webapp/components/suggestion/suggestion_box.jsx
@@ -5,7 +5,7 @@ import $ from 'jquery';
import ReactDOM from 'react-dom';
import Constants from 'utils/constants.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import SuggestionStore from 'stores/suggestion_store.jsx';
import * as Utils from 'utils/utils.jsx';
diff --git a/webapp/components/suggestion/suggestion_list.jsx b/webapp/components/suggestion/suggestion_list.jsx
index 71f767104..91f7443cb 100644
--- a/webapp/components/suggestion/suggestion_list.jsx
+++ b/webapp/components/suggestion/suggestion_list.jsx
@@ -3,7 +3,7 @@
import $ from 'jquery';
import ReactDOM from 'react-dom';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import SuggestionStore from 'stores/suggestion_store.jsx';
import React from 'react';
diff --git a/webapp/components/tutorial/tutorial_intro_screens.jsx b/webapp/components/tutorial/tutorial_intro_screens.jsx
index a4928f9cb..277ff967f 100644
--- a/webapp/components/tutorial/tutorial_intro_screens.jsx
+++ b/webapp/components/tutorial/tutorial_intro_screens.jsx
@@ -6,7 +6,7 @@ import TeamStore from 'stores/team_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import * as Utils from 'utils/utils.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/user_settings/manage_languages.jsx b/webapp/components/user_settings/manage_languages.jsx
index bbf3a2e40..269181922 100644
--- a/webapp/components/user_settings/manage_languages.jsx
+++ b/webapp/components/user_settings/manage_languages.jsx
@@ -5,7 +5,7 @@ import SettingItemMax from '../setting_item_max.jsx';
import Client from 'utils/web_client.jsx';
import * as I18n from 'i18n/i18n.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
diff --git a/webapp/components/user_settings/user_settings_developer.jsx b/webapp/components/user_settings/user_settings_developer.jsx
index cabb021cb..ae6d60362 100644
--- a/webapp/components/user_settings/user_settings_developer.jsx
+++ b/webapp/components/user_settings/user_settings_developer.jsx
@@ -3,7 +3,7 @@
import SettingItemMin from '../setting_item_min.jsx';
import SettingItemMax from '../setting_item_max.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
@@ -135,4 +135,4 @@ DeveloperTab.propTypes = {
collapseModal: React.PropTypes.func.isRequired
};
-export default injectIntl(DeveloperTab); \ No newline at end of file
+export default injectIntl(DeveloperTab);
diff --git a/webapp/components/view_image.jsx b/webapp/components/view_image.jsx
index f70a57cb8..7b827ac0e 100644
--- a/webapp/components/view_image.jsx
+++ b/webapp/components/view_image.jsx
@@ -3,7 +3,7 @@
import $ from 'jquery';
import * as AsyncClient from 'utils/async_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import * as Utils from 'utils/utils.jsx';
import AudioVideoPreview from './audio_video_preview.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/root.jsx b/webapp/root.jsx
index 0515c6579..dc2df64ac 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -29,8 +29,8 @@ import * as Utils from 'utils/utils.jsx';
import Client from 'utils/web_client.jsx';
-import * as Websockets from 'action_creators/websocket_actions.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as Websockets from 'actions/websocket_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import SignupUserComplete from 'components/signup_user_complete.jsx';
import ShouldVerifyEmail from 'components/should_verify_email.jsx';
import DoVerifyEmail from 'components/do_verify_email.jsx';
@@ -82,15 +82,15 @@ import LicenseSettings from 'components/admin_console/license_settings.jsx';
import Audits from 'components/admin_console/audits.jsx';
import Logs from 'components/admin_console/logs.jsx';
-import Claim from 'components/claim/claim.jsx';
+import ClaimController from 'components/claim/claim_controller.jsx';
import EmailToOAuth from 'components/claim/components/email_to_oauth.jsx';
import OAuthToEmail from 'components/claim/components/oauth_to_email.jsx';
import LDAPToEmail from 'components/claim/components/ldap_to_email.jsx';
import EmailToLDAP from 'components/claim/components/email_to_ldap.jsx';
-import Login from 'components/login/login.jsx';
+import LoginController from 'components/login/login_controller.jsx';
import SelectTeam from 'components/select_team/select_team.jsx';
-import CreateTeam from 'components/create_team/create_team.jsx';
+import CreateTeamController from 'components/create_team/create_team_controller.jsx';
import CreateTeamDisplayName from 'components/create_team/components/display_name.jsx';
import CreateTeamTeamUrl from 'components/create_team/components/team_url.jsx';
@@ -279,7 +279,7 @@ function renderRootComponent() {
<Route component={HeaderFooterTemplate}>
<Route
path='login'
- component={Login}
+ component={LoginController}
/>
<Route
path='reset_password'
@@ -291,7 +291,7 @@ function renderRootComponent() {
/>
<Route
path='claim'
- component={Claim}
+ component={ClaimController}
>
<Route
path='oauth_to_email'
@@ -334,7 +334,7 @@ function renderRootComponent() {
/>
<Route
path='create_team'
- component={CreateTeam}
+ component={CreateTeamController}
>
<IndexRoute component={CreateTeamDisplayName}/>
<Route
diff --git a/webapp/stores/team_store.jsx b/webapp/stores/team_store.jsx
index 8eebbaca5..210d5c211 100644
--- a/webapp/stores/team_store.jsx
+++ b/webapp/stores/team_store.jsx
@@ -177,6 +177,11 @@ TeamStore.dispatchToken = AppDispatcher.register((payload) => {
TeamStore.saveMyTeam(action.team);
TeamStore.emitChange();
break;
+ case ActionTypes.CREATED_TEAM:
+ TeamStore.saveTeam(action.team);
+ TeamStore.appendTeamMember(action.member);
+ TeamStore.emitChange();
+ break;
case ActionTypes.RECEIVED_ALL_TEAMS:
TeamStore.saveTeams(action.teams);
TeamStore.emitChange();
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index 7ddf299f6..6f5f8a2cd 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -3,7 +3,7 @@
import $ from 'jquery';
import Client from './web_client.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import BrowserStore from 'stores/browser_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
diff --git a/webapp/utils/channel_intro_messages.jsx b/webapp/utils/channel_intro_messages.jsx
index 1d18e26ba..c9dd30712 100644
--- a/webapp/utils/channel_intro_messages.jsx
+++ b/webapp/utils/channel_intro_messages.jsx
@@ -8,7 +8,7 @@ import ToggleModalButton from 'components/toggle_modal_button.jsx';
import UserProfile from 'components/user_profile.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import Constants from 'utils/constants.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Client from 'utils/web_client.jsx';
import React from 'react';
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index 2f99b81ea..e53701755 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -88,6 +88,7 @@ export default {
RECEIVED_MSG: null,
RECEIVED_MY_TEAM: null,
+ CREATED_TEAM: null,
RECEIVED_CONFIG: null,
RECEIVED_LOGS: null,
@@ -723,6 +724,8 @@ export default {
}
},
OVERLAY_TIME_DELAY: 400,
+ MIN_TEAMNAME_LENGTH: 4,
+ MAX_TEAMNAME_LENGTH: 15,
MIN_USERNAME_LENGTH: 3,
MAX_USERNAME_LENGTH: 22,
MIN_PASSWORD_LENGTH: 5,
diff --git a/webapp/utils/web_client.jsx b/webapp/utils/web_client.jsx
index f6e2d6ac5..b974ad31f 100644
--- a/webapp/utils/web_client.jsx
+++ b/webapp/utils/web_client.jsx
@@ -4,7 +4,7 @@
import Client from 'mattermost/client.jsx';
import TeamStore from '../stores/team_store.jsx';
import BrowserStore from '../stores/browser_store.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import request from 'superagent';