Refactor login, claim and create_team into views and add actions (#3110)

This commit is contained in:
Joram Wilander
2016-05-26 09:46:18 -04:00
committed by Harrison Healey
parent 9c0caaa765
commit 6fecfcc7ca
44 changed files with 163 additions and 149 deletions

View File

@@ -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();
}

View File

@@ -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,

View File

@@ -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
);
}

View File

@@ -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;

View File

@@ -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';

View File

@@ -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
};

View File

@@ -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';

View File

@@ -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';

View File

@@ -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);

View File

@@ -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 * 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 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);

View File

@@ -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
};

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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
};

View File

@@ -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';

View File

@@ -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';

View File

@@ -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
};
};

View File

@@ -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';

View File

@@ -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;

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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) {

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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);
export default injectIntl(DeveloperTab);

View File

@@ -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';

View File

@@ -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

View File

@@ -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();

View File

@@ -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';

View File

@@ -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';

View File

@@ -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,

View File

@@ -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';