Merge pull request #2529 from mattermost/plt-2383

PLT-2383 Fixed system console login page flash.
Этот коммит содержится в:
Harrison Healey
2016-03-24 12:45:12 -04:00
родитель 998ce12133 d6a6668a39
Коммит c64b12e27a
35 изменённых файлов: 152 добавлений и 177 удалений

Просмотреть файл

@@ -63,8 +63,8 @@ export default class AdminNavbarDropdown extends React.Component {
role='menu' role='menu'
> >
<li> <li>
<a <Link
href={Utils.getWindowLocationOrigin() + '/' + this.state.currentTeam.name} to={Utils.getWindowLocationOrigin() + '/' + this.state.currentTeam.name + '/channels/town-square'}
> >
<FormattedMessage <FormattedMessage
id='admin.nav.switch' id='admin.nav.switch'
@@ -73,7 +73,7 @@ export default class AdminNavbarDropdown extends React.Component {
display_name: this.state.currentTeam.display_name display_name: this.state.currentTeam.display_name
}} }}
/> />
</a> </Link>
</li> </li>
<li> <li>
<Link to={Utils.getTeamURLFromAddressBar() + '/logout'}> <Link to={Utils.getTeamURLFromAddressBar() + '/logout'}>
@@ -83,29 +83,6 @@ export default class AdminNavbarDropdown extends React.Component {
/> />
</Link> </Link>
</li> </li>
<li className='divider'></li>
<li>
<a
target='_blank'
href='/static/help/help.html'
>
<FormattedMessage
id='admin.nav.help'
defaultMessage='Help'
/>
</a>
</li>
<li>
<a
target='_blank'
href='/static/help/report_problem.html'
>
<FormattedMessage
id='admin.nav.report'
defaultMessage='Report a Problem'
/>
</a>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>

Просмотреть файл

@@ -10,6 +10,7 @@ import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import React from 'react'; import React from 'react';
import {browserHistory} from 'react-router';
export default class UserItem extends React.Component { export default class UserItem extends React.Component {
constructor(props) { constructor(props) {
@@ -158,9 +159,9 @@ export default class UserItem extends React.Component {
const teamUrl = TeamStore.getCurrentTeamUrl(); const teamUrl = TeamStore.getCurrentTeamUrl();
if (teamUrl) { if (teamUrl) {
window.location.href = teamUrl; browserHistory.push(teamUrl);
} else { } else {
window.location.href = '/'; browserHistory.push('/');
} }
}, },
(err) => { (err) => {

Просмотреть файл

@@ -22,6 +22,7 @@ const TutorialSteps = Constants.TutorialSteps;
const Preferences = Constants.Preferences; const Preferences = Constants.Preferences;
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
export default class CenterPanel extends React.Component { export default class CenterPanel extends React.Component {
constructor(props) { constructor(props) {
@@ -83,13 +84,13 @@ export default class CenterPanel extends React.Component {
id='archive-link-home' id='archive-link-home'
onClick={handleClick} onClick={handleClick}
> >
<a href=''> <Link to=''>
<FormattedMessage <FormattedMessage
id='center_panel.recent' id='center_panel.recent'
defaultMessage='Click here to jump to recent messages. ' defaultMessage='Click here to jump to recent messages. '
/> />
<i className='fa fa-arrow-down'></i> <i className='fa fa-arrow-down'></i>
</a> </Link>
</div> </div>
); );
} else { } else {

Просмотреть файл

@@ -5,6 +5,7 @@ import TeamStore from 'stores/team_store.jsx';
import React from 'react'; import React from 'react';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {Link} from 'react-router';
import logoImage from 'images/logo.png'; import logoImage from 'images/logo.png';
@@ -50,12 +51,12 @@ export default class Claim extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span className='fa fa-chevron-left'/> <span className='fa fa-chevron-left'/>
<FormattedMessage <FormattedMessage
id='web.header.back' id='web.header.back'
/> />
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container'> <div className='signup-team__container'>

Просмотреть файл

@@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
export default class EmailToLDAP extends React.Component { export default class EmailToLDAP extends React.Component {
constructor(props) { constructor(props) {
@@ -54,7 +55,7 @@ export default class EmailToLDAP extends React.Component {
Client.emailToLDAP(postData, Client.emailToLDAP(postData,
(data) => { (data) => {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; browserHistory.push(data.follow_link);
} }
}, },
(error) => { (error) => {

Просмотреть файл

@@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
export default class EmailToOAuth extends React.Component { export default class EmailToOAuth extends React.Component {
constructor(props) { constructor(props) {
@@ -39,7 +40,7 @@ export default class EmailToOAuth extends React.Component {
Client.emailToOAuth(postData, Client.emailToOAuth(postData,
(data) => { (data) => {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; browserHistory.push(data.follow_link);
} }
}, },
(error) => { (error) => {

Просмотреть файл

@@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
export default class LDAPToEmail extends React.Component { export default class LDAPToEmail extends React.Component {
constructor(props) { constructor(props) {
@@ -53,7 +54,7 @@ export default class LDAPToEmail extends React.Component {
Client.ldapToEmail(postData, Client.ldapToEmail(postData,
(data) => { (data) => {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; browserHistory.push(data.follow_link);
} }
}, },
(error) => { (error) => {

Просмотреть файл

@@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
export default class OAuthToEmail extends React.Component { export default class OAuthToEmail extends React.Component {
constructor(props) { constructor(props) {
@@ -45,7 +46,7 @@ export default class OAuthToEmail extends React.Component {
Client.oauthToEmail(postData, Client.oauthToEmail(postData,
(data) => { (data) => {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; browserHistory.push(data.follow_link);
} }
}, },
(error) => { (error) => {

Просмотреть файл

@@ -23,6 +23,7 @@ import PreferenceStore from 'stores/preference_store.jsx';
import Constants from 'utils/constants.jsx'; import Constants from 'utils/constants.jsx';
import {intlShape, injectIntl, defineMessages, FormattedHTMLMessage} from 'react-intl'; import {intlShape, injectIntl, defineMessages, FormattedHTMLMessage} from 'react-intl';
import {browserHistory} from 'react-router';
const Preferences = Constants.Preferences; const Preferences = Constants.Preferences;
const TutorialSteps = Constants.TutorialSteps; const TutorialSteps = Constants.TutorialSteps;
@@ -136,7 +137,7 @@ class CreatePost extends React.Component {
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null}); this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
if (data.goto_location && data.goto_location.length > 0) { if (data.goto_location && data.goto_location.length > 0) {
window.location.href = data.goto_location; browserHistory.push(data.goto_location);
} }
}, },
(err) => { (err) => {

Просмотреть файл

@@ -5,7 +5,7 @@ import {FormattedMessage} from 'react-intl';
import * as Client from 'utils/client.jsx'; import * as Client from 'utils/client.jsx';
import LoadingScreen from './loading_screen.jsx'; import LoadingScreen from './loading_screen.jsx';
import {browserHistory} from 'react-router'; import {browserHistory, Link} from 'react-router';
import React from 'react'; import React from 'react';
@@ -43,12 +43,12 @@ export default class DoVerifyEmail extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span className='fa fa-chevron-left'/> <span className='fa fa-chevron-left'/>
<FormattedMessage <FormattedMessage
id='web.header.back' id='web.header.back'
/> />
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container'> <div className='signup-team__container'>

Просмотреть файл

@@ -5,6 +5,7 @@ import * as Utils from 'utils/utils.jsx';
import {defineMessages} from 'react-intl'; import {defineMessages} from 'react-intl';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
const holders = defineMessages({ const holders = defineMessages({
type: { type: {
@@ -33,14 +34,14 @@ export default function FileInfoPreview({filename, fileUrl, fileInfo, formatMess
return ( return (
<div className='file-details__container'> <div className='file-details__container'>
<a <Link
className={'file-details__preview'} className={'file-details__preview'}
href={fileUrl} to={fileUrl}
target='_blank' target='_blank'
> >
<span className='file-details__preview-helper'/> <span className='file-details__preview-helper'/>
<img src={Utils.getPreviewImagePath(filename)}/> <img src={Utils.getPreviewImagePath(filename)}/>
</a> </Link>
<div className='file-details'> <div className='file-details'>
<div className='file-details__name'>{name}</div> <div className='file-details__name'>{name}</div>
<div className='file-details__info'>{infoString}</div> <div className='file-details__info'>{infoString}</div>

Просмотреть файл

@@ -11,7 +11,7 @@ import Constants from 'utils/constants.jsx';
import TeamStore from 'stores/team_store.jsx'; import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router'; import {browserHistory, Link} from 'react-router';
import React from 'react'; import React from 'react';
@@ -29,6 +29,8 @@ export default class Login extends React.Component {
Client.getMeLoggedIn((data) => { Client.getMeLoggedIn((data) => {
if (data && data.logged_in !== 'false') { if (data && data.logged_in !== 'false') {
browserHistory.push('/' + this.props.params.team + '/channels/town-square'); browserHistory.push('/' + this.props.params.team + '/channels/town-square');
} else {
this.setState({doneCheckLogin: true}); //eslint-disable-line react/no-did-mount-set-state
} }
}); });
} }
@@ -37,7 +39,8 @@ export default class Login extends React.Component {
} }
getStateFromStores() { getStateFromStores() {
return { return {
currentTeam: TeamStore.getByName(this.props.params.team) currentTeam: TeamStore.getByName(this.props.params.team),
doneCheckLogin: false
}; };
} }
onTeamChange() { onTeamChange() {
@@ -45,7 +48,7 @@ export default class Login extends React.Component {
} }
render() { render() {
const currentTeam = this.state.currentTeam; const currentTeam = this.state.currentTeam;
if (currentTeam == null) { if (currentTeam == null || !this.state.doneCheckLogin) {
return <div/>; return <div/>;
} }
@@ -57,10 +60,10 @@ export default class Login extends React.Component {
let loginMessage = []; let loginMessage = [];
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
loginMessage.push( loginMessage.push(
<a <Link
className='btn btn-custom-login gitlab' className='btn btn-custom-login gitlab'
key='gitlab' key='gitlab'
href={'/api/v1/oauth/gitlab/login?team=' + encodeURIComponent(teamName)} to={'/api/v1/oauth/gitlab/login?team=' + encodeURIComponent(teamName)}
> >
<span className='icon'/> <span className='icon'/>
<span> <span>
@@ -69,16 +72,16 @@ export default class Login extends React.Component {
defaultMessage='with GitLab' defaultMessage='with GitLab'
/> />
</span> </span>
</a> </Link>
); );
} }
if (global.window.mm_config.EnableSignUpWithGoogle === 'true') { if (global.window.mm_config.EnableSignUpWithGoogle === 'true') {
loginMessage.push( loginMessage.push(
<a <Link
className='btn btn-custom-login google' className='btn btn-custom-login google'
key='google' key='google'
href={'/api/v1/oauth/google/login?team=' + encodeURIComponent(teamName)} to={'/api/v1/oauth/google/login?team=' + encodeURIComponent(teamName)}
> >
<span className='icon'/> <span className='icon'/>
<span> <span>
@@ -87,7 +90,7 @@ export default class Login extends React.Component {
defaultMessage='with Google Apps' defaultMessage='with Google Apps'
/> />
</span> </span>
</a> </Link>
); );
} }
@@ -154,12 +157,12 @@ export default class Login extends React.Component {
if (emailSignup) { if (emailSignup) {
forgotPassword = ( forgotPassword = (
<div className='form-group'> <div className='form-group'>
<a href={'/' + teamName + '/reset_password'}> <Link to={'/' + teamName + '/reset_password'}>
<FormattedMessage <FormattedMessage
id='login.forgot' id='login.forgot'
defaultMessage='I forgot my password' defaultMessage='I forgot my password'
/> />
</a> </Link>
</div> </div>
); );
} }
@@ -173,15 +176,15 @@ export default class Login extends React.Component {
id='login.noAccount' id='login.noAccount'
defaultMessage="Don't have an account? " defaultMessage="Don't have an account? "
/> />
<a <Link
href={'/signup_user_complete/?id=' + currentTeam.invite_id} to={'/signup_user_complete/?id=' + currentTeam.invite_id}
className='signup-team-login' className='signup-team-login'
> >
<FormattedMessage <FormattedMessage
id='login.create' id='login.create'
defaultMessage='Create one now' defaultMessage='Create one now'
/> />
</a> </Link>
</span> </span>
</div> </div>
); );
@@ -191,15 +194,15 @@ export default class Login extends React.Component {
if (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp()) { if (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp()) {
teamSignUp = ( teamSignUp = (
<div className='margin--extra'> <div className='margin--extra'>
<a <Link
href='/' to='/'
className='signup-team-login' className='signup-team-login'
> >
<FormattedMessage <FormattedMessage
id='login.createTeam' id='login.createTeam'
defaultMessage='Create a new team' defaultMessage='Create a new team'
/> />
</a> </Link>
</div> </div>
); );
} }
@@ -257,12 +260,12 @@ export default class Login extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span className='fa fa-chevron-left'/> <span className='fa fa-chevron-left'/>
<FormattedMessage <FormattedMessage
id='web.header.back' id='web.header.back'
/> />
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container'> <div className='signup-team__container'>

Просмотреть файл

@@ -79,7 +79,7 @@ class LoginEmail extends React.Component {
}, },
(err) => { (err) => {
if (err.id === 'api.user.login.not_verified.app_error') { if (err.id === 'api.user.login.not_verified.app_error') {
window.location.href = '/verify_email?teamname=' + encodeURIComponent(name) + '&email=' + encodeURIComponent(email); browserHistory.push('/verify_email?teamname=' + encodeURIComponent(name) + '&email=' + encodeURIComponent(email));
return; return;
} }
state.serverError = err.message; state.serverError = err.message;

Просмотреть файл

@@ -5,6 +5,7 @@ import * as Utils from 'utils/utils.jsx';
import * as Client from 'utils/client.jsx'; import * as Client from 'utils/client.jsx';
import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
const holders = defineMessages({ const holders = defineMessages({
badTeam: { badTeam: {
@@ -74,9 +75,9 @@ class LoginLdap extends React.Component {
() => { () => {
const redirect = Utils.getUrlParameter('redirect'); const redirect = Utils.getUrlParameter('redirect');
if (redirect) { if (redirect) {
window.location.href = decodeURIComponent(redirect); browserHistory.push(decodeURIComponent(redirect));
} else { } else {
window.location.href = '/' + teamName + '/channels/town-square'; browserHistory.push('/' + teamName + '/channels/town-square');
} }
}, },
(err) => { (err) => {

Просмотреть файл

@@ -6,6 +6,7 @@ import * as Client from 'utils/client.jsx';
import UserStore from 'stores/user_store.jsx'; import UserStore from 'stores/user_store.jsx';
import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
var holders = defineMessages({ var holders = defineMessages({
badTeam: { badTeam: {
@@ -85,9 +86,9 @@ export default class LoginUsername extends React.Component {
const redirect = Utils.getUrlParameter('redirect'); const redirect = Utils.getUrlParameter('redirect');
if (redirect) { if (redirect) {
window.location.href = decodeURIComponent(redirect); browserHistory.push(decodeURIComponent(redirect));
} else { } else {
window.location.href = '/' + name + '/channels/town-square'; browserHistory.push('/' + name + '/channels/town-square');
} }
}, },
(err) => { (err) => {

Просмотреть файл

@@ -30,6 +30,8 @@ import {FormattedMessage} from 'react-intl';
import {Popover, OverlayTrigger} from 'react-bootstrap'; import {Popover, OverlayTrigger} from 'react-bootstrap';
import {Link, browserHistory} from 'react-router';
import React from 'react'; import React from 'react';
export default class Navbar extends React.Component { export default class Navbar extends React.Component {
@@ -81,7 +83,7 @@ export default class Navbar extends React.Component {
Client.leaveChannel(this.state.channel.id, Client.leaveChannel(this.state.channel.id,
() => { () => {
AsyncClient.getChannels(true); AsyncClient.getChannels(true);
window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square'; browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square');
}, },
(err) => { (err) => {
AsyncClient.dispatchError(err, 'handleLeave'); AsyncClient.dispatchError(err, 'handleLeave');
@@ -349,12 +351,12 @@ export default class Navbar extends React.Component {
return ( return (
<div className='navbar-brand'> <div className='navbar-brand'>
<a <Link
href={TeamStore.getCurrentTeamUrl() + '/channels/town-square'} to={TeamStore.getCurrentTeamUrl() + '/channels/town-square'}
className='heading' className='heading'
> >
{channelTitle} {channelTitle}
</a> </Link>
</div> </div>
); );
} }

Просмотреть файл

@@ -128,14 +128,14 @@ export default class NavbarDropdown extends React.Component {
if (isSystemAdmin) { if (isSystemAdmin) {
sysAdminLink = ( sysAdminLink = (
<li> <li>
<a <Link
href={'/admin_console'} to={'/admin_console'}
> >
<FormattedMessage <FormattedMessage
id='navbar_dropdown.console' id='navbar_dropdown.console'
defaultMessage='System Console' defaultMessage='System Console'
/> />
</a> </Link>
</li> </li>
); );
} }
@@ -145,16 +145,16 @@ export default class NavbarDropdown extends React.Component {
if (global.window.mm_config.EnableTeamCreation === 'true') { if (global.window.mm_config.EnableTeamCreation === 'true') {
teams.push( teams.push(
<li key='newTeam_li'> <li key='newTeam_li'>
<a <Link
key='newTeam_a' key='newTeam_a'
target='_blank' target='_blank'
href={Utils.getWindowLocationOrigin() + '/signup_team'} to={Utils.getWindowLocationOrigin() + '/signup_team'}
> >
<FormattedMessage <FormattedMessage
id='navbar_dropdown.create' id='navbar_dropdown.create'
defaultMessage='Create a New Team' defaultMessage='Create a New Team'
/> />
</a> </Link>
</li> </li>
); );
} }
@@ -163,15 +163,15 @@ export default class NavbarDropdown extends React.Component {
if (global.window.mm_config.HelpLink) { if (global.window.mm_config.HelpLink) {
helpLink = ( helpLink = (
<li> <li>
<a <Link
target='_blank' target='_blank'
href={global.window.mm_config.HelpLink} to={global.window.mm_config.HelpLink}
> >
<FormattedMessage <FormattedMessage
id='navbar_dropdown.help' id='navbar_dropdown.help'
defaultMessage='Help' defaultMessage='Help'
/> />
</a> </Link>
</li> </li>
); );
} }
@@ -180,15 +180,15 @@ export default class NavbarDropdown extends React.Component {
if (global.window.mm_config.ReportAProblemLink) { if (global.window.mm_config.ReportAProblemLink) {
reportLink = ( reportLink = (
<li> <li>
<a <Link
target='_blank' target='_blank'
href={global.window.mm_config.ReportAProblemLink} to={global.window.mm_config.ReportAProblemLink}
> >
<FormattedMessage <FormattedMessage
id='navbar_dropdown.report' id='navbar_dropdown.report'
defaultMessage='Report a Problem' defaultMessage='Report a Problem'
/> />
</a> </Link>
</li> </li>
); );
} }

Просмотреть файл

@@ -5,6 +5,7 @@ import $ from 'jquery';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
export default class NotLoggedIn extends React.Component { export default class NotLoggedIn extends React.Component {
componentDidMount() { componentDidMount() {
@@ -29,34 +30,34 @@ export default class NotLoggedIn extends React.Component {
</div> </div>
<div className='col-xs-12'> <div className='col-xs-12'>
<span className='pull-right footer-link copyright'>{'© 2015 Mattermost, Inc.'}</span> <span className='pull-right footer-link copyright'>{'© 2015 Mattermost, Inc.'}</span>
<a <Link
id='help_link' id='help_link'
className='pull-right footer-link' className='pull-right footer-link'
href={global.window.mm_config.HelpLink} to={global.window.mm_config.HelpLink}
> >
<FormattedMessage id='web.footer.help'/> <FormattedMessage id='web.footer.help'/>
</a> </Link>
<a <Link
id='terms_link' id='terms_link'
className='pull-right footer-link' className='pull-right footer-link'
href={global.window.mm_config.TermsOfServiceLink} to={global.window.mm_config.TermsOfServiceLink}
> >
<FormattedMessage id='web.footer.terms'/> <FormattedMessage id='web.footer.terms'/>
</a> </Link>
<a <Link
id='privacy_link' id='privacy_link'
className='pull-right footer-link' className='pull-right footer-link'
href={global.window.mm_config.PrivacyPolicyLink} to={global.window.mm_config.PrivacyPolicyLink}
> >
<FormattedMessage id='web.footer.privacy'/> <FormattedMessage id='web.footer.privacy'/>
</a> </Link>
<a <Link
id='about_link' id='about_link'
className='pull-right footer-link' className='pull-right footer-link'
href={global.window.mm_config.AboutLink} to={global.window.mm_config.AboutLink}
> >
<FormattedMessage id='web.footer.about'/> <FormattedMessage id='web.footer.about'/>
</a> </Link>
</div> </div>
</div> </div>
</div> </div>

Просмотреть файл

@@ -9,6 +9,7 @@ import * as client from 'utils/client.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
class PasswordResetSendLink extends React.Component { class PasswordResetSendLink extends React.Component {
constructor(props) { constructor(props) {
@@ -87,12 +88,12 @@ class PasswordResetSendLink extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span className='fa fa-chevron-left'/> <span className='fa fa-chevron-left'/>
<FormattedMessage <FormattedMessage
id='web.header.back' id='web.header.back'
/> />
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container'> <div className='signup-team__container'>

Просмотреть файл

@@ -5,6 +5,7 @@ import {FormattedMessage} from 'react-intl';
import * as Client from 'utils/client.jsx'; import * as Client from 'utils/client.jsx';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
export default class ShouldVerifyEmail extends React.Component { export default class ShouldVerifyEmail extends React.Component {
constructor(props) { constructor(props) {
@@ -63,12 +64,12 @@ export default class ShouldVerifyEmail extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span className='fa fa-chevron-left'/> <span className='fa fa-chevron-left'/>
<FormattedMessage <FormattedMessage
id='web.header.back' id='web.header.back'
/> />
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container'> <div className='signup-team__container'>

Просмотреть файл

@@ -29,6 +29,7 @@ import {Tooltip, OverlayTrigger} from 'react-bootstrap';
import loadingGif from 'images/load.gif'; import loadingGif from 'images/load.gif';
import React from 'react'; import React from 'react';
import {browserHistory} from 'react-router';
import favicon from 'images/favicon/favicon-16x16.png'; import favicon from 'images/favicon/favicon-16x16.png';
import redFavicon from 'images/favicon/redfavicon-16x16.png'; import redFavicon from 'images/favicon/redfavicon-16x16.png';
@@ -407,7 +408,6 @@ export default class Sidebar extends React.Component {
// set up click handler to switch channels (or create a new channel for non-existant ones) // set up click handler to switch channels (or create a new channel for non-existant ones)
var handleClick = null; var handleClick = null;
var href = '#';
if (!channel.fake) { if (!channel.fake) {
handleClick = function clickHandler(e) { handleClick = function clickHandler(e) {
@@ -440,7 +440,7 @@ export default class Sidebar extends React.Component {
}, },
() => { () => {
this.setState({loadingDMChannel: -1}); this.setState({loadingDMChannel: -1});
window.location.href = '/' + this.state.currentTeam.name; browserHistory('/' + this.state.currentTeam.name);
} }
); );
} }
@@ -489,7 +489,7 @@ export default class Sidebar extends React.Component {
> >
<a <a
className={rowClass} className={rowClass}
href={href} href={'#'}
onClick={handleClick} onClick={handleClick}
> >
{icon} {icon}

Просмотреть файл

@@ -101,15 +101,15 @@ export default class SidebarRightMenu extends React.Component {
if (isSystemAdmin && !Utils.isMobile()) { if (isSystemAdmin && !Utils.isMobile()) {
consoleLink = ( consoleLink = (
<li> <li>
<a <Link
href={'/admin_console'} to={'/admin_console'}
> >
<i className='fa fa-wrench'></i> <i className='fa fa-wrench'></i>
<FormattedMessage <FormattedMessage
id='sidebar_right_menu.console' id='sidebar_right_menu.console'
defaultMessage='System Console' defaultMessage='System Console'
/> />
</a> </Link>
</li> </li>
); );
} }
@@ -127,16 +127,16 @@ export default class SidebarRightMenu extends React.Component {
if (global.window.mm_config.HelpLink) { if (global.window.mm_config.HelpLink) {
helpLink = ( helpLink = (
<li> <li>
<a <Link
target='_blank' target='_blank'
href={global.window.mm_config.HelpLink} to={global.window.mm_config.HelpLink}
> >
<i className='fa fa-question'></i> <i className='fa fa-question'></i>
<FormattedMessage <FormattedMessage
id='sidebar_right_menu.help' id='sidebar_right_menu.help'
defaultMessage='Help' defaultMessage='Help'
/> />
</a> </Link>
</li> </li>
); );
} }
@@ -145,16 +145,16 @@ export default class SidebarRightMenu extends React.Component {
if (global.window.mm_config.ReportAProblemLink) { if (global.window.mm_config.ReportAProblemLink) {
reportLink = ( reportLink = (
<li> <li>
<a <Link
target='_blank' target='_blank'
href={global.window.mm_config.ReportAProblemLink} to={global.window.mm_config.ReportAProblemLink}
> >
<i className='fa fa-phone'></i> <i className='fa fa-phone'></i>
<FormattedMessage <FormattedMessage
id='sidebar_right_menu.report' id='sidebar_right_menu.report'
defaultMessage='Report a Problem' defaultMessage='Report a Problem'
/> />
</a> </Link>
</li> </li>
); );
} }
@@ -164,10 +164,12 @@ export default class SidebarRightMenu extends React.Component {
id='sidebar-menu' id='sidebar-menu'
> >
<div className='team__header theme'> <div className='team__header theme'>
<a <Link
className='team__name' className='team__name'
href='/channels/town-square' to='/channels/town-square'
>{teamDisplayName}</a> >
{teamDisplayName}
</Link>
</div> </div>
<div className='nav-pills__container'> <div className='nav-pills__container'>

Просмотреть файл

@@ -12,6 +12,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
import logoImage from 'images/logo.png'; import logoImage from 'images/logo.png';
@@ -109,15 +110,15 @@ export default class TeamSignUp extends React.Component {
key={'team_' + team.name} key={'team_' + team.name}
className='signup-team-dir' className='signup-team-dir'
> >
<a <Link
href={'/' + team.name} to={'/' + team.name}
> >
<span className='signup-team-dir__name'>{team.display_name}</span> <span className='signup-team-dir__name'>{team.display_name}</span>
<span <span
className='glyphicon glyphicon-menu-right right signup-team-dir__arrow' className='glyphicon glyphicon-menu-right right signup-team-dir__arrow'
aria-hidden='true' aria-hidden='true'
/> />
</a> </Link>
</div> </div>
); );
} }

Просмотреть файл

@@ -8,6 +8,7 @@ import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router'; import {browserHistory} from 'react-router';
import React from 'react'; import React from 'react';
import Link from 'react-router';
export default class SignupTeamComplete extends React.Component { export default class SignupTeamComplete extends React.Component {
constructor(props) { constructor(props) {
@@ -53,10 +54,10 @@ export default class SignupTeamComplete extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span classNameName='fa fa-chevron-left'/> <span classNameName='fa fa-chevron-left'/>
<FormattedMessage id='web.header.back'/> <FormattedMessage id='web.header.back'/>
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container'> <div className='signup-team__container'>

Просмотреть файл

@@ -76,7 +76,7 @@ class TeamSignupWelcomePage extends React.Component {
Client.signupTeam(email, Client.signupTeam(email,
function success(data) { function success(data) {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; browserHistory.push(data.follow_link);
} else { } else {
this.props.state.wizard = 'finished'; this.props.state.wizard = 'finished';
this.props.updateParent(this.props.state); this.props.updateParent(this.props.state);

Просмотреть файл

@@ -2,6 +2,7 @@
// See License.txt for license information. // See License.txt for license information.
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import {Link} from 'react-router';
import React from 'react'; import React from 'react';
@@ -10,12 +11,12 @@ export default class SignupTeamConfirm extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span className='fa fa-chevron-left'/> <span className='fa fa-chevron-left'/>
<FormattedMessage <FormattedMessage
id='web.header.back' id='web.header.back'
/> />
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div classNameName='signup-team__container'> <div classNameName='signup-team__container'>

Просмотреть файл

@@ -10,7 +10,7 @@ import Constants from 'utils/constants.jsx';
import LoadingScreen from 'components/loading_screen.jsx'; import LoadingScreen from 'components/loading_screen.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import {browserHistory} from 'react-router'; import {browserHistory, Link} from 'react-router';
import React from 'react'; import React from 'react';
@@ -317,10 +317,10 @@ class SignupUserComplete extends React.Component {
var signupMessage = []; var signupMessage = [];
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
signupMessage.push( signupMessage.push(
<a <Link
className='btn btn-custom-login gitlab' className='btn btn-custom-login gitlab'
key='gitlab' key='gitlab'
href={'/api/v1/oauth/gitlab/signup' + window.location.search + '&team=' + encodeURIComponent(this.state.teamName)} to={'/api/v1/oauth/gitlab/signup' + window.location.search + '&team=' + encodeURIComponent(this.state.teamName)}
> >
<span className='icon'/> <span className='icon'/>
<span> <span>
@@ -329,16 +329,16 @@ class SignupUserComplete extends React.Component {
defaultMessage='with GitLab' defaultMessage='with GitLab'
/> />
</span> </span>
</a> </Link>
); );
} }
if (global.window.mm_config.EnableSignUpWithGoogle === 'true') { if (global.window.mm_config.EnableSignUpWithGoogle === 'true') {
signupMessage.push( signupMessage.push(
<a <Link
className='btn btn-custom-login google' className='btn btn-custom-login google'
key='google' key='google'
href={'/api/v1/oauth/google/signup' + window.location.search + '&team=' + encodeURIComponent(this.state.teamName)} to={'/api/v1/oauth/google/signup' + window.location.search + '&team=' + encodeURIComponent(this.state.teamName)}
> >
<span className='icon'/> <span className='icon'/>
<span> <span>
@@ -347,7 +347,7 @@ class SignupUserComplete extends React.Component {
defaultMessage='with Google' defaultMessage='with Google'
/> />
</span> </span>
</a> </Link>
); );
} }
@@ -442,10 +442,10 @@ class SignupUserComplete extends React.Component {
return ( return (
<div> <div>
<div className='signup-header'> <div className='signup-header'>
<a href='/'> <Link to='/'>
<span classNameNameName='fa fa-chevron-left'/> <span classNameNameName='fa fa-chevron-left'/>
<FormattedMessage id='web.header.back'/> <FormattedMessage id='web.header.back'/>
</a> </Link>
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container padding--less'> <div className='signup-team__container padding--less'>

Просмотреть файл

@@ -6,6 +6,7 @@ import * as Client from 'utils/client.jsx';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
export default class TeamExportTab extends React.Component { export default class TeamExportTab extends React.Component {
constructor(props) { constructor(props) {
@@ -54,15 +55,15 @@ export default class TeamExportTab extends React.Component {
id='team_export_tab.ready' id='team_export_tab.ready'
defaultMessage=' Ready for ' defaultMessage=' Ready for '
/> />
<a <Link
href={this.state.link} to={this.state.link}
download={true} download={true}
> >
<FormattedMessage <FormattedMessage
id='team_export_tab.download' id='team_export_tab.download'
defaultMessage='download' defaultMessage='download'
/> />
</a> </Link>
</p> </p>
); );
break; break;

Просмотреть файл

@@ -12,6 +12,7 @@ import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import React from 'react'; import React from 'react';
import {browserHistory} from 'react-router';
export default class TeamMembersDropdown extends React.Component { export default class TeamMembersDropdown extends React.Component {
constructor(props) { constructor(props) {
@@ -119,9 +120,9 @@ export default class TeamMembersDropdown extends React.Component {
() => { () => {
const teamUrl = TeamStore.getCurrentTeamUrl(); const teamUrl = TeamStore.getCurrentTeamUrl();
if (teamUrl) { if (teamUrl) {
window.location.href = teamUrl; browserHistory.push(teamUrl);
} else { } else {
window.location.href = '/'; browserHistory.push('/');
} }
}, },
(err) => { (err) => {

Просмотреть файл

@@ -122,14 +122,6 @@ export default class ChooseAuthPage extends React.Component {
return ( return (
<div> <div>
{buttons} {buttons}
<div className='form-group margin--extra-2x'>
<span><a href='/find_team'>
<FormattedMessage
id='choose_auth_page.find'
defaultMessage='Find my teams'
/>
</a></span>
</div>
</div> </div>
); );
} }

Просмотреть файл

@@ -102,14 +102,6 @@ class EmailSignUpPage extends React.Component {
</button> </button>
{serverError} {serverError}
</div> </div>
<div className='form-group margin--extra-2x'>
<span><a href='/find_team'>
<FormattedMessage
id='email_signup.find'
defaultMessage='Find my teams'
/>
</a></span>
</div>
</form> </form>
); );
} }

Просмотреть файл

@@ -7,6 +7,7 @@ import * as utils from 'utils/utils.jsx';
import * as Client from 'utils/client.jsx'; import * as Client from 'utils/client.jsx';
import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router';
const holders = defineMessages({ const holders = defineMessages({
team_error: { team_error: {
@@ -112,7 +113,7 @@ class LdapSignUpPage extends React.Component {
Client.loginByLdap(teamSignup.team.name, id, password, Client.loginByLdap(teamSignup.team.name, id, password,
() => { () => {
window.location.href = '/' + teamSignup.team.name + '/channels/town-square'; browserHistory.push('/' + teamSignup.team.name + '/channels/town-square');
}, },
(err) => { (err) => {
$('#ldap-button').button('reset'); $('#ldap-button').button('reset');
@@ -218,14 +219,6 @@ class LdapSignUpPage extends React.Component {
</a> </a>
{serverError} {serverError}
</div> </div>
<div className='form-group margin--extra-2x'>
<span><a href='/find_team'>
<FormattedMessage
id='ldap_signup.find'
defaultMessage='Find my teams'
/>
</a></span>
</div>
</form> </form>
); );
} }

Просмотреть файл

@@ -24,6 +24,7 @@ const holders = defineMessages({
}); });
import React from 'react'; import React from 'react';
import {browserHistory} from 'react-router';
class SSOSignUpPage extends React.Component { class SSOSignUpPage extends React.Component {
constructor(props) { constructor(props) {
@@ -63,9 +64,9 @@ class SSOSignUpPage extends React.Component {
this.props.service, this.props.service,
(data) => { (data) => {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; browserHistory.push(data.follow_link);
} else { } else {
window.location.href = '/' + team.name + '/channels/town-square'; browserHistory.push('/' + team.name + '/channels/town-square');
} }
}, },
(err) => { (err) => {
@@ -157,14 +158,6 @@ class SSOSignUpPage extends React.Component {
{button} {button}
{serverError} {serverError}
</div> </div>
<div className='form-group margin--extra-2x'>
<span><a href='/find_team'>
<FormattedMessage
id='sso_signup.find'
defaultMessage='Find my teams'
/>
</a></span>
</div>
</form> </form>
); );
} }

Просмотреть файл

@@ -7,6 +7,7 @@ import ChannelStore from 'stores/channel_store.jsx';
const ytRegex = /(?:http|https):\/\/(?:www\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(\/u\/\w\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^\/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#\&\?]*)/; const ytRegex = /(?:http|https):\/\/(?:www\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(\/u\/\w\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^\/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#\&\?]*)/;
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
export default class YoutubeVideo extends React.Component { export default class YoutubeVideo extends React.Component {
constructor(props) { constructor(props) {
@@ -156,7 +157,7 @@ export default class YoutubeVideo extends React.Component {
<div> <div>
<h4> <h4>
<span className='video-type'>{header}</span> <span className='video-type'>{header}</span>
<span className='video-title'><a href={this.props.link}>{this.state.title}</a></span> <span className='video-title'><Link to={this.props.link}>{this.state.title}</Link></span>
</h4> </h4>
<div <div
className='video-div embed-responsive-item' className='video-div embed-responsive-item'

Просмотреть файл

@@ -17,6 +17,7 @@ import * as client from './client.jsx';
import Autolinker from 'autolinker'; import Autolinker from 'autolinker';
import React from 'react'; import React from 'react';
import {browserHistory} from 'react-router';
import {FormattedTime} from 'react-intl'; import {FormattedTime} from 'react-intl';
import icon50 from 'images/icon50x50.png'; import icon50 from 'images/icon50x50.png';
@@ -170,7 +171,7 @@ export function notifyMe(title, body, channel) {
if (channel) { if (channel) {
switchChannel(channel); switchChannel(channel);
} else { } else {
window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square'; browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square');
} }
}; };
setTimeout(() => { setTimeout(() => {
@@ -1303,7 +1304,7 @@ export function openDirectChannelToUser(user, successCb, errorCb) {
} }
}, },
() => { () => {
window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/' + channelName; browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/' + channelName);
if ($.isFunction(errorCb)) { if ($.isFunction(errorCb)) {
errorCb(); errorCb();
} }