From b62e29ba9cd6183551266da05b9b602a4415d738 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 24 Mar 2016 11:05:13 -0400 Subject: Moving all links and redirects to react-router --- .../admin_console/admin_navbar_dropdown.jsx | 29 ++---------------- webapp/components/admin_console/user_item.jsx | 5 ++-- webapp/components/center_panel.jsx | 5 ++-- webapp/components/claim/claim.jsx | 5 ++-- .../components/claim/components/email_to_ldap.jsx | 3 +- .../components/claim/components/email_to_oauth.jsx | 3 +- .../components/claim/components/ldap_to_email.jsx | 3 +- .../components/claim/components/oauth_to_email.jsx | 3 +- webapp/components/create_post.jsx | 3 +- webapp/components/do_verify_email.jsx | 6 ++-- webapp/components/file_info_preview.jsx | 7 +++-- webapp/components/login.jsx | 34 +++++++++++----------- webapp/components/login_email.jsx | 2 +- webapp/components/login_ldap.jsx | 7 +++-- webapp/components/login_username.jsx | 5 ++-- webapp/components/navbar.jsx | 10 ++++--- webapp/components/navbar_dropdown.jsx | 24 +++++++-------- webapp/components/not_logged_in.jsx | 25 ++++++++-------- webapp/components/password_reset_send_link.jsx | 5 ++-- webapp/components/should_verify_email.jsx | 5 ++-- webapp/components/sidebar.jsx | 6 ++-- webapp/components/sidebar_right_menu.jsx | 26 +++++++++-------- webapp/components/signup_team.jsx | 7 +++-- .../components/signup_team_complete.jsx | 5 ++-- .../components/team_signup_welcome_page.jsx | 2 +- webapp/components/signup_team_confirm.jsx | 5 ++-- webapp/components/signup_user_complete.jsx | 18 ++++++------ webapp/components/team_export_tab.jsx | 7 +++-- webapp/components/team_members_dropdown.jsx | 5 ++-- webapp/components/team_signup_choose_auth.jsx | 8 ----- webapp/components/team_signup_with_email.jsx | 8 ----- webapp/components/team_signup_with_ldap.jsx | 13 ++------- webapp/components/team_signup_with_sso.jsx | 15 +++------- webapp/components/youtube_video.jsx | 3 +- webapp/utils/utils.jsx | 5 ++-- 35 files changed, 147 insertions(+), 175 deletions(-) (limited to 'webapp') diff --git a/webapp/components/admin_console/admin_navbar_dropdown.jsx b/webapp/components/admin_console/admin_navbar_dropdown.jsx index 56b78448a..9644a2e7f 100644 --- a/webapp/components/admin_console/admin_navbar_dropdown.jsx +++ b/webapp/components/admin_console/admin_navbar_dropdown.jsx @@ -63,8 +63,8 @@ export default class AdminNavbarDropdown extends React.Component { role='menu' >
  • - - +
  • @@ -83,29 +83,6 @@ export default class AdminNavbarDropdown extends React.Component { />
  • -
  • -
  • - - - -
  • -
  • - - - -
  • diff --git a/webapp/components/admin_console/user_item.jsx b/webapp/components/admin_console/user_item.jsx index c6498eafc..91f567d4d 100644 --- a/webapp/components/admin_console/user_item.jsx +++ b/webapp/components/admin_console/user_item.jsx @@ -10,6 +10,7 @@ import TeamStore from 'stores/team_store.jsx'; import {FormattedMessage} from 'react-intl'; import React from 'react'; +import {browserHistory} from 'react-router'; export default class UserItem extends React.Component { constructor(props) { @@ -158,9 +159,9 @@ export default class UserItem extends React.Component { const teamUrl = TeamStore.getCurrentTeamUrl(); if (teamUrl) { - window.location.href = teamUrl; + browserHistory.push(teamUrl); } else { - window.location.href = '/'; + browserHistory.push('/'); } }, (err) => { diff --git a/webapp/components/center_panel.jsx b/webapp/components/center_panel.jsx index 6c156f2a8..62b12c1d2 100644 --- a/webapp/components/center_panel.jsx +++ b/webapp/components/center_panel.jsx @@ -22,6 +22,7 @@ const TutorialSteps = Constants.TutorialSteps; const Preferences = Constants.Preferences; import React from 'react'; +import {Link} from 'react-router'; export default class CenterPanel extends React.Component { constructor(props) { @@ -83,13 +84,13 @@ export default class CenterPanel extends React.Component { id='archive-link-home' onClick={handleClick} > - + - + ); } else { diff --git a/webapp/components/claim/claim.jsx b/webapp/components/claim/claim.jsx index 464187c37..5cfb04af3 100644 --- a/webapp/components/claim/claim.jsx +++ b/webapp/components/claim/claim.jsx @@ -5,6 +5,7 @@ import TeamStore from 'stores/team_store.jsx'; import React from 'react'; import {FormattedMessage} from 'react-intl'; +import {Link} from 'react-router'; import logoImage from 'images/logo.png'; @@ -50,12 +51,12 @@ export default class Claim extends React.Component { return (
    - + - +
    diff --git a/webapp/components/claim/components/email_to_ldap.jsx b/webapp/components/claim/components/email_to_ldap.jsx index f3046fa74..1f51f9cd5 100644 --- a/webapp/components/claim/components/email_to_ldap.jsx +++ b/webapp/components/claim/components/email_to_ldap.jsx @@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx'; import React from 'react'; import ReactDOM from 'react-dom'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; export default class EmailToLDAP extends React.Component { constructor(props) { @@ -54,7 +55,7 @@ export default class EmailToLDAP extends React.Component { Client.emailToLDAP(postData, (data) => { if (data.follow_link) { - window.location.href = data.follow_link; + browserHistory.push(data.follow_link); } }, (error) => { diff --git a/webapp/components/claim/components/email_to_oauth.jsx b/webapp/components/claim/components/email_to_oauth.jsx index f3e370a4a..f4376067a 100644 --- a/webapp/components/claim/components/email_to_oauth.jsx +++ b/webapp/components/claim/components/email_to_oauth.jsx @@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx'; import React from 'react'; import ReactDOM from 'react-dom'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; export default class EmailToOAuth extends React.Component { constructor(props) { @@ -39,7 +40,7 @@ export default class EmailToOAuth extends React.Component { Client.emailToOAuth(postData, (data) => { if (data.follow_link) { - window.location.href = data.follow_link; + browserHistory.push(data.follow_link); } }, (error) => { diff --git a/webapp/components/claim/components/ldap_to_email.jsx b/webapp/components/claim/components/ldap_to_email.jsx index b4ffd4944..ed8a314bd 100644 --- a/webapp/components/claim/components/ldap_to_email.jsx +++ b/webapp/components/claim/components/ldap_to_email.jsx @@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx'; import React from 'react'; import ReactDOM from 'react-dom'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; export default class LDAPToEmail extends React.Component { constructor(props) { @@ -53,7 +54,7 @@ export default class LDAPToEmail extends React.Component { Client.ldapToEmail(postData, (data) => { if (data.follow_link) { - window.location.href = data.follow_link; + browserHistory.push(data.follow_link); } }, (error) => { diff --git a/webapp/components/claim/components/oauth_to_email.jsx b/webapp/components/claim/components/oauth_to_email.jsx index 476677aeb..72e0500a9 100644 --- a/webapp/components/claim/components/oauth_to_email.jsx +++ b/webapp/components/claim/components/oauth_to_email.jsx @@ -7,6 +7,7 @@ import * as Client from 'utils/client.jsx'; import React from 'react'; import ReactDOM from 'react-dom'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; export default class OAuthToEmail extends React.Component { constructor(props) { @@ -45,7 +46,7 @@ export default class OAuthToEmail extends React.Component { Client.oauthToEmail(postData, (data) => { if (data.follow_link) { - window.location.href = data.follow_link; + browserHistory.push(data.follow_link); } }, (error) => { diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx index e5e99debd..025333d97 100644 --- a/webapp/components/create_post.jsx +++ b/webapp/components/create_post.jsx @@ -23,6 +23,7 @@ import PreferenceStore from 'stores/preference_store.jsx'; import Constants from 'utils/constants.jsx'; import {intlShape, injectIntl, defineMessages, FormattedHTMLMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; const Preferences = Constants.Preferences; const TutorialSteps = Constants.TutorialSteps; @@ -136,7 +137,7 @@ class CreatePost extends React.Component { this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null}); if (data.goto_location && data.goto_location.length > 0) { - window.location.href = data.goto_location; + browserHistory.push(data.goto_location); } }, (err) => { diff --git a/webapp/components/do_verify_email.jsx b/webapp/components/do_verify_email.jsx index a984d2e52..c3be111ed 100644 --- a/webapp/components/do_verify_email.jsx +++ b/webapp/components/do_verify_email.jsx @@ -5,7 +5,7 @@ import {FormattedMessage} from 'react-intl'; import * as Client from 'utils/client.jsx'; import LoadingScreen from './loading_screen.jsx'; -import {browserHistory} from 'react-router'; +import {browserHistory, Link} from 'react-router'; import React from 'react'; @@ -43,12 +43,12 @@ export default class DoVerifyEmail extends React.Component { return (
    - + - +
    diff --git a/webapp/components/file_info_preview.jsx b/webapp/components/file_info_preview.jsx index a0ec282c4..d5dcd75eb 100644 --- a/webapp/components/file_info_preview.jsx +++ b/webapp/components/file_info_preview.jsx @@ -5,6 +5,7 @@ import * as Utils from 'utils/utils.jsx'; import {defineMessages} from 'react-intl'; import React from 'react'; +import {Link} from 'react-router'; const holders = defineMessages({ type: { @@ -33,14 +34,14 @@ export default function FileInfoPreview({filename, fileUrl, fileInfo, formatMess return (
    - - +
    {name}
    {infoString}
    diff --git a/webapp/components/login.jsx b/webapp/components/login.jsx index a60303d11..ad30f0619 100644 --- a/webapp/components/login.jsx +++ b/webapp/components/login.jsx @@ -11,7 +11,7 @@ import Constants from 'utils/constants.jsx'; import TeamStore from 'stores/team_store.jsx'; import {FormattedMessage} from 'react-intl'; -import {browserHistory} from 'react-router'; +import {browserHistory, Link} from 'react-router'; import React from 'react'; @@ -57,10 +57,10 @@ export default class Login extends React.Component { let loginMessage = []; if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { loginMessage.push( - @@ -69,16 +69,16 @@ export default class Login extends React.Component { defaultMessage='with GitLab' /> - + ); } if (global.window.mm_config.EnableSignUpWithGoogle === 'true') { loginMessage.push( - @@ -87,7 +87,7 @@ export default class Login extends React.Component { defaultMessage='with Google Apps' /> - + ); } @@ -154,12 +154,12 @@ export default class Login extends React.Component { if (emailSignup) { forgotPassword = (
    - + - +
    ); } @@ -173,15 +173,15 @@ export default class Login extends React.Component { id='login.noAccount' defaultMessage="Don't have an account? " /> - - +
    ); @@ -191,15 +191,15 @@ export default class Login extends React.Component { if (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp()) { teamSignUp = (
    - - +
    ); } @@ -257,12 +257,12 @@ export default class Login extends React.Component { return (
    - + - +
    diff --git a/webapp/components/login_email.jsx b/webapp/components/login_email.jsx index e30b66fa3..d54c32ff9 100644 --- a/webapp/components/login_email.jsx +++ b/webapp/components/login_email.jsx @@ -79,7 +79,7 @@ class LoginEmail extends React.Component { }, (err) => { 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; } state.serverError = err.message; diff --git a/webapp/components/login_ldap.jsx b/webapp/components/login_ldap.jsx index b9997dec4..59ff973dc 100644 --- a/webapp/components/login_ldap.jsx +++ b/webapp/components/login_ldap.jsx @@ -5,6 +5,7 @@ import * as Utils from 'utils/utils.jsx'; import * as Client from 'utils/client.jsx'; import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; const holders = defineMessages({ badTeam: { @@ -74,9 +75,9 @@ class LoginLdap extends React.Component { () => { const redirect = Utils.getUrlParameter('redirect'); if (redirect) { - window.location.href = decodeURIComponent(redirect); + browserHistory.push(decodeURIComponent(redirect)); } else { - window.location.href = '/' + teamName + '/channels/town-square'; + browserHistory.push('/' + teamName + '/channels/town-square'); } }, (err) => { @@ -141,4 +142,4 @@ LoginLdap.propTypes = { teamName: React.PropTypes.string.isRequired }; -export default injectIntl(LoginLdap); \ No newline at end of file +export default injectIntl(LoginLdap); diff --git a/webapp/components/login_username.jsx b/webapp/components/login_username.jsx index 5fa27f2d5..71874fa1a 100644 --- a/webapp/components/login_username.jsx +++ b/webapp/components/login_username.jsx @@ -6,6 +6,7 @@ import * as Client from 'utils/client.jsx'; import UserStore from 'stores/user_store.jsx'; import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; var holders = defineMessages({ badTeam: { @@ -85,9 +86,9 @@ export default class LoginUsername extends React.Component { const redirect = Utils.getUrlParameter('redirect'); if (redirect) { - window.location.href = decodeURIComponent(redirect); + browserHistory.push(decodeURIComponent(redirect)); } else { - window.location.href = '/' + name + '/channels/town-square'; + browserHistory.push('/' + name + '/channels/town-square'); } }, (err) => { diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx index 520f05ed0..e58e142d0 100644 --- a/webapp/components/navbar.jsx +++ b/webapp/components/navbar.jsx @@ -30,6 +30,8 @@ import {FormattedMessage} from 'react-intl'; import {Popover, OverlayTrigger} from 'react-bootstrap'; +import {Link, browserHistory} from 'react-router'; + import React from 'react'; export default class Navbar extends React.Component { @@ -81,7 +83,7 @@ export default class Navbar extends React.Component { Client.leaveChannel(this.state.channel.id, () => { AsyncClient.getChannels(true); - window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square'; + browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square'); }, (err) => { AsyncClient.dispatchError(err, 'handleLeave'); @@ -349,12 +351,12 @@ export default class Navbar extends React.Component { return ( ); } diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx index 9038522ac..7e42a71ea 100644 --- a/webapp/components/navbar_dropdown.jsx +++ b/webapp/components/navbar_dropdown.jsx @@ -128,14 +128,14 @@ export default class NavbarDropdown extends React.Component { if (isSystemAdmin) { sysAdminLink = (
  • - - +
  • ); } @@ -145,16 +145,16 @@ export default class NavbarDropdown extends React.Component { if (global.window.mm_config.EnableTeamCreation === 'true') { teams.push(
  • - - +
  • ); } @@ -163,15 +163,15 @@ export default class NavbarDropdown extends React.Component { if (global.window.mm_config.HelpLink) { helpLink = (
  • - - +
  • ); } @@ -180,15 +180,15 @@ export default class NavbarDropdown extends React.Component { if (global.window.mm_config.ReportAProblemLink) { reportLink = (
  • - - +
  • ); } diff --git a/webapp/components/not_logged_in.jsx b/webapp/components/not_logged_in.jsx index ac359056a..4beee6259 100644 --- a/webapp/components/not_logged_in.jsx +++ b/webapp/components/not_logged_in.jsx @@ -5,6 +5,7 @@ import $ from 'jquery'; import {FormattedMessage} from 'react-intl'; import React from 'react'; +import {Link} from 'react-router'; export default class NotLoggedIn extends React.Component { componentDidMount() { @@ -29,34 +30,34 @@ export default class NotLoggedIn extends React.Component {
    {'© 2015 Mattermost, Inc.'} - - - + - - + - - + - +
    diff --git a/webapp/components/password_reset_send_link.jsx b/webapp/components/password_reset_send_link.jsx index 3098e0d23..a42b8935c 100644 --- a/webapp/components/password_reset_send_link.jsx +++ b/webapp/components/password_reset_send_link.jsx @@ -9,6 +9,7 @@ import * as client from 'utils/client.jsx'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import React from 'react'; +import {Link} from 'react-router'; class PasswordResetSendLink extends React.Component { constructor(props) { @@ -87,12 +88,12 @@ class PasswordResetSendLink extends React.Component { return (
    - + - +
    diff --git a/webapp/components/should_verify_email.jsx b/webapp/components/should_verify_email.jsx index 82beff067..5103452b0 100644 --- a/webapp/components/should_verify_email.jsx +++ b/webapp/components/should_verify_email.jsx @@ -5,6 +5,7 @@ import {FormattedMessage} from 'react-intl'; import * as Client from 'utils/client.jsx'; import React from 'react'; +import {Link} from 'react-router'; export default class ShouldVerifyEmail extends React.Component { constructor(props) { @@ -63,12 +64,12 @@ export default class ShouldVerifyEmail extends React.Component { return (
    - + - +
    diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index 0e1b7dd0e..c0d4755ed 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -29,6 +29,7 @@ import {Tooltip, OverlayTrigger} from 'react-bootstrap'; import loadingGif from 'images/load.gif'; import React from 'react'; +import {browserHistory} from 'react-router'; import favicon from 'images/favicon/favicon-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) var handleClick = null; - var href = '#'; if (!channel.fake) { handleClick = function clickHandler(e) { @@ -440,7 +440,7 @@ export default class Sidebar extends React.Component { }, () => { 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 { > {icon} diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx index 05e2054ea..7c5e895e8 100644 --- a/webapp/components/sidebar_right_menu.jsx +++ b/webapp/components/sidebar_right_menu.jsx @@ -101,15 +101,15 @@ export default class SidebarRightMenu extends React.Component { if (isSystemAdmin && !Utils.isMobile()) { consoleLink = (
  • - - +
  • ); } @@ -127,16 +127,16 @@ export default class SidebarRightMenu extends React.Component { if (global.window.mm_config.HelpLink) { helpLink = (
  • - - +
  • ); } @@ -145,16 +145,16 @@ export default class SidebarRightMenu extends React.Component { if (global.window.mm_config.ReportAProblemLink) { reportLink = (
  • - - +
  • ); } @@ -164,10 +164,12 @@ export default class SidebarRightMenu extends React.Component { id='sidebar-menu' >
    - {teamDisplayName} + to='/channels/town-square' + > + {teamDisplayName} +
    diff --git a/webapp/components/signup_team.jsx b/webapp/components/signup_team.jsx index 7b06aa767..e6b27e745 100644 --- a/webapp/components/signup_team.jsx +++ b/webapp/components/signup_team.jsx @@ -12,6 +12,7 @@ import * as AsyncClient from 'utils/async_client.jsx'; import {FormattedMessage} from 'react-intl'; import React from 'react'; +import {Link} from 'react-router'; import logoImage from 'images/logo.png'; @@ -109,15 +110,15 @@ export default class TeamSignUp extends React.Component { key={'team_' + team.name} className='signup-team-dir' > - {team.display_name} +
    ); } diff --git a/webapp/components/signup_team_complete/components/signup_team_complete.jsx b/webapp/components/signup_team_complete/components/signup_team_complete.jsx index 02040c734..8b2096499 100644 --- a/webapp/components/signup_team_complete/components/signup_team_complete.jsx +++ b/webapp/components/signup_team_complete/components/signup_team_complete.jsx @@ -8,6 +8,7 @@ import {FormattedMessage} from 'react-intl'; import {browserHistory} from 'react-router'; import React from 'react'; +import Link from 'react-router'; export default class SignupTeamComplete extends React.Component { constructor(props) { @@ -53,10 +54,10 @@ export default class SignupTeamComplete extends React.Component { return (
    - + - +
    diff --git a/webapp/components/signup_team_complete/components/team_signup_welcome_page.jsx b/webapp/components/signup_team_complete/components/team_signup_welcome_page.jsx index 78d7cec47..15b708128 100644 --- a/webapp/components/signup_team_complete/components/team_signup_welcome_page.jsx +++ b/webapp/components/signup_team_complete/components/team_signup_welcome_page.jsx @@ -76,7 +76,7 @@ class TeamSignupWelcomePage extends React.Component { Client.signupTeam(email, function success(data) { if (data.follow_link) { - window.location.href = data.follow_link; + browserHistory.push(data.follow_link); } else { this.props.state.wizard = 'finished'; this.props.updateParent(this.props.state); diff --git a/webapp/components/signup_team_confirm.jsx b/webapp/components/signup_team_confirm.jsx index 2a5e34856..117a0b068 100644 --- a/webapp/components/signup_team_confirm.jsx +++ b/webapp/components/signup_team_confirm.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; +import {Link} from 'react-router'; import React from 'react'; @@ -10,12 +11,12 @@ export default class SignupTeamConfirm extends React.Component { return (
    - + - +
    diff --git a/webapp/components/signup_user_complete.jsx b/webapp/components/signup_user_complete.jsx index e07b9529c..5460daf29 100644 --- a/webapp/components/signup_user_complete.jsx +++ b/webapp/components/signup_user_complete.jsx @@ -10,7 +10,7 @@ import Constants from 'utils/constants.jsx'; import LoadingScreen from 'components/loading_screen.jsx'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; -import {browserHistory} from 'react-router'; +import {browserHistory, Link} from 'react-router'; import React from 'react'; @@ -317,10 +317,10 @@ class SignupUserComplete extends React.Component { var signupMessage = []; if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { signupMessage.push( - @@ -329,16 +329,16 @@ class SignupUserComplete extends React.Component { defaultMessage='with GitLab' /> - + ); } if (global.window.mm_config.EnableSignUpWithGoogle === 'true') { signupMessage.push( - @@ -347,7 +347,7 @@ class SignupUserComplete extends React.Component { defaultMessage='with Google' /> - + ); } @@ -442,10 +442,10 @@ class SignupUserComplete extends React.Component { return (
    - + - +
    diff --git a/webapp/components/team_export_tab.jsx b/webapp/components/team_export_tab.jsx index e21264a47..9bd5785a0 100644 --- a/webapp/components/team_export_tab.jsx +++ b/webapp/components/team_export_tab.jsx @@ -6,6 +6,7 @@ import * as Client from 'utils/client.jsx'; import {FormattedMessage} from 'react-intl'; import React from 'react'; +import {Link} from 'react-router'; export default class TeamExportTab extends React.Component { constructor(props) { @@ -54,15 +55,15 @@ export default class TeamExportTab extends React.Component { id='team_export_tab.ready' defaultMessage=' Ready for ' /> - - +

    ); break; diff --git a/webapp/components/team_members_dropdown.jsx b/webapp/components/team_members_dropdown.jsx index 5b63087c6..ad82a2280 100644 --- a/webapp/components/team_members_dropdown.jsx +++ b/webapp/components/team_members_dropdown.jsx @@ -12,6 +12,7 @@ import TeamStore from 'stores/team_store.jsx'; import {FormattedMessage} from 'react-intl'; import React from 'react'; +import {browserHistory} from 'react-router'; export default class TeamMembersDropdown extends React.Component { constructor(props) { @@ -119,9 +120,9 @@ export default class TeamMembersDropdown extends React.Component { () => { const teamUrl = TeamStore.getCurrentTeamUrl(); if (teamUrl) { - window.location.href = teamUrl; + browserHistory.push(teamUrl); } else { - window.location.href = '/'; + browserHistory.push('/'); } }, (err) => { diff --git a/webapp/components/team_signup_choose_auth.jsx b/webapp/components/team_signup_choose_auth.jsx index d26e8a9ac..7a4ce972a 100644 --- a/webapp/components/team_signup_choose_auth.jsx +++ b/webapp/components/team_signup_choose_auth.jsx @@ -122,14 +122,6 @@ export default class ChooseAuthPage extends React.Component { return (
    {buttons} -
    - - - -
    ); } diff --git a/webapp/components/team_signup_with_email.jsx b/webapp/components/team_signup_with_email.jsx index 12a679791..90a6e9773 100644 --- a/webapp/components/team_signup_with_email.jsx +++ b/webapp/components/team_signup_with_email.jsx @@ -102,14 +102,6 @@ class EmailSignUpPage extends React.Component { {serverError}
    -
    - - - -
    ); } diff --git a/webapp/components/team_signup_with_ldap.jsx b/webapp/components/team_signup_with_ldap.jsx index e36d4a42b..9d812e8ee 100644 --- a/webapp/components/team_signup_with_ldap.jsx +++ b/webapp/components/team_signup_with_ldap.jsx @@ -7,6 +7,7 @@ import * as utils from 'utils/utils.jsx'; import * as Client from 'utils/client.jsx'; import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; const holders = defineMessages({ team_error: { @@ -112,7 +113,7 @@ class LdapSignUpPage extends React.Component { 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) => { $('#ldap-button').button('reset'); @@ -218,14 +219,6 @@ class LdapSignUpPage extends React.Component { {serverError}
    -
    - - - -
    ); } @@ -235,4 +228,4 @@ LdapSignUpPage.propTypes = { intl: intlShape.isRequired }; -export default injectIntl(LdapSignUpPage); \ No newline at end of file +export default injectIntl(LdapSignUpPage); diff --git a/webapp/components/team_signup_with_sso.jsx b/webapp/components/team_signup_with_sso.jsx index 4f84f13cf..9a46b2d6b 100644 --- a/webapp/components/team_signup_with_sso.jsx +++ b/webapp/components/team_signup_with_sso.jsx @@ -24,6 +24,7 @@ const holders = defineMessages({ }); import React from 'react'; +import {browserHistory} from 'react-router'; class SSOSignUpPage extends React.Component { constructor(props) { @@ -63,9 +64,9 @@ class SSOSignUpPage extends React.Component { this.props.service, (data) => { if (data.follow_link) { - window.location.href = data.follow_link; + browserHistory.push(data.follow_link); } else { - window.location.href = '/' + team.name + '/channels/town-square'; + browserHistory.push('/' + team.name + '/channels/town-square'); } }, (err) => { @@ -157,14 +158,6 @@ class SSOSignUpPage extends React.Component { {button} {serverError}
    -
    - - - -
    ); } @@ -178,4 +171,4 @@ SSOSignUpPage.propTypes = { service: React.PropTypes.string }; -export default injectIntl(SSOSignUpPage); \ No newline at end of file +export default injectIntl(SSOSignUpPage); diff --git a/webapp/components/youtube_video.jsx b/webapp/components/youtube_video.jsx index 2bd9a6702..6083fd8a1 100644 --- a/webapp/components/youtube_video.jsx +++ b/webapp/components/youtube_video.jsx @@ -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\/))([^#\&\?]*)/; import React from 'react'; +import {Link} from 'react-router'; export default class YoutubeVideo extends React.Component { constructor(props) { @@ -156,7 +157,7 @@ export default class YoutubeVideo extends React.Component {

    {header} - {this.state.title} + {this.state.title}

    { @@ -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)) { errorCb(); } -- cgit v1.2.3-1-g7c22