diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-24 11:05:13 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-24 11:05:13 -0400 |
commit | b62e29ba9cd6183551266da05b9b602a4415d738 (patch) | |
tree | ea759d6d46cc49386bcd66a8b9b8542f75b1c77e | |
parent | 68dad8c7345b12c7d0b10709ddc1873d4b40163e (diff) | |
download | chat-b62e29ba9cd6183551266da05b9b602a4415d738.tar.gz chat-b62e29ba9cd6183551266da05b9b602a4415d738.tar.bz2 chat-b62e29ba9cd6183551266da05b9b602a4415d738.zip |
Moving all links and redirects to react-router
35 files changed, 147 insertions, 175 deletions
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' > <li> - <a - href={Utils.getWindowLocationOrigin() + '/' + this.state.currentTeam.name} + <Link + to={Utils.getWindowLocationOrigin() + '/' + this.state.currentTeam.name} > <FormattedMessage id='admin.nav.switch' @@ -73,7 +73,7 @@ export default class AdminNavbarDropdown extends React.Component { display_name: this.state.currentTeam.display_name }} /> - </a> + </Link> </li> <li> <Link to={Utils.getTeamURLFromAddressBar() + '/logout'}> @@ -83,29 +83,6 @@ export default class AdminNavbarDropdown extends React.Component { /> </Link> </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> </li> </ul> 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} > - <a href=''> + <Link to=''> <FormattedMessage id='center_panel.recent' defaultMessage='Click here to jump to recent messages. ' /> <i className='fa fa-arrow-down'></i> - </a> + </Link> </div> ); } 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 ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span className='fa fa-chevron-left'/> <FormattedMessage id='web.header.back' /> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container'> 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 ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span className='fa fa-chevron-left'/> <FormattedMessage id='web.header.back' /> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container'> 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 ( <div className='file-details__container'> - <a + <Link className={'file-details__preview'} - href={fileUrl} + to={fileUrl} target='_blank' > <span className='file-details__preview-helper'/> <img src={Utils.getPreviewImagePath(filename)}/> - </a> + </Link> <div className='file-details'> <div className='file-details__name'>{name}</div> <div className='file-details__info'>{infoString}</div> 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( - <a + <Link className='btn btn-custom-login 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> @@ -69,16 +69,16 @@ export default class Login extends React.Component { defaultMessage='with GitLab' /> </span> - </a> + </Link> ); } if (global.window.mm_config.EnableSignUpWithGoogle === 'true') { loginMessage.push( - <a + <Link className='btn btn-custom-login 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> @@ -87,7 +87,7 @@ export default class Login extends React.Component { defaultMessage='with Google Apps' /> </span> - </a> + </Link> ); } @@ -154,12 +154,12 @@ export default class Login extends React.Component { if (emailSignup) { forgotPassword = ( <div className='form-group'> - <a href={'/' + teamName + '/reset_password'}> + <Link to={'/' + teamName + '/reset_password'}> <FormattedMessage id='login.forgot' defaultMessage='I forgot my password' /> - </a> + </Link> </div> ); } @@ -173,15 +173,15 @@ export default class Login extends React.Component { id='login.noAccount' defaultMessage="Don't have an account? " /> - <a - href={'/signup_user_complete/?id=' + currentTeam.invite_id} + <Link + to={'/signup_user_complete/?id=' + currentTeam.invite_id} className='signup-team-login' > <FormattedMessage id='login.create' defaultMessage='Create one now' /> - </a> + </Link> </span> </div> ); @@ -191,15 +191,15 @@ export default class Login extends React.Component { if (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp()) { teamSignUp = ( <div className='margin--extra'> - <a - href='/' + <Link + to='/' className='signup-team-login' > <FormattedMessage id='login.createTeam' defaultMessage='Create a new team' /> - </a> + </Link> </div> ); } @@ -257,12 +257,12 @@ export default class Login extends React.Component { return ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span className='fa fa-chevron-left'/> <FormattedMessage id='web.header.back' /> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container'> 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 ( <div className='navbar-brand'> - <a - href={TeamStore.getCurrentTeamUrl() + '/channels/town-square'} + <Link + to={TeamStore.getCurrentTeamUrl() + '/channels/town-square'} className='heading' > {channelTitle} - </a> + </Link> </div> ); } 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 = ( <li> - <a - href={'/admin_console'} + <Link + to={'/admin_console'} > <FormattedMessage id='navbar_dropdown.console' defaultMessage='System Console' /> - </a> + </Link> </li> ); } @@ -145,16 +145,16 @@ export default class NavbarDropdown extends React.Component { if (global.window.mm_config.EnableTeamCreation === 'true') { teams.push( <li key='newTeam_li'> - <a + <Link key='newTeam_a' target='_blank' - href={Utils.getWindowLocationOrigin() + '/signup_team'} + to={Utils.getWindowLocationOrigin() + '/signup_team'} > <FormattedMessage id='navbar_dropdown.create' defaultMessage='Create a New Team' /> - </a> + </Link> </li> ); } @@ -163,15 +163,15 @@ export default class NavbarDropdown extends React.Component { if (global.window.mm_config.HelpLink) { helpLink = ( <li> - <a + <Link target='_blank' - href={global.window.mm_config.HelpLink} + to={global.window.mm_config.HelpLink} > <FormattedMessage id='navbar_dropdown.help' defaultMessage='Help' /> - </a> + </Link> </li> ); } @@ -180,15 +180,15 @@ export default class NavbarDropdown extends React.Component { if (global.window.mm_config.ReportAProblemLink) { reportLink = ( <li> - <a + <Link target='_blank' - href={global.window.mm_config.ReportAProblemLink} + to={global.window.mm_config.ReportAProblemLink} > <FormattedMessage id='navbar_dropdown.report' defaultMessage='Report a Problem' /> - </a> + </Link> </li> ); } 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 { </div> <div className='col-xs-12'> <span className='pull-right footer-link copyright'>{'© 2015 Mattermost, Inc.'}</span> - <a + <Link id='help_link' className='pull-right footer-link' - href={global.window.mm_config.HelpLink} + to={global.window.mm_config.HelpLink} > <FormattedMessage id='web.footer.help'/> - </a> - <a + </Link> + <Link id='terms_link' className='pull-right footer-link' - href={global.window.mm_config.TermsOfServiceLink} + to={global.window.mm_config.TermsOfServiceLink} > <FormattedMessage id='web.footer.terms'/> - </a> - <a + </Link> + <Link id='privacy_link' className='pull-right footer-link' - href={global.window.mm_config.PrivacyPolicyLink} + to={global.window.mm_config.PrivacyPolicyLink} > <FormattedMessage id='web.footer.privacy'/> - </a> - <a + </Link> + <Link id='about_link' className='pull-right footer-link' - href={global.window.mm_config.AboutLink} + to={global.window.mm_config.AboutLink} > <FormattedMessage id='web.footer.about'/> - </a> + </Link> </div> </div> </div> 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 ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span className='fa fa-chevron-left'/> <FormattedMessage id='web.header.back' /> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container'> 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 ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span className='fa fa-chevron-left'/> <FormattedMessage id='web.header.back' /> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container'> 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 { > <a className={rowClass} - href={href} + href={'#'} onClick={handleClick} > {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 = ( <li> - <a - href={'/admin_console'} + <Link + to={'/admin_console'} > <i className='fa fa-wrench'></i> <FormattedMessage id='sidebar_right_menu.console' defaultMessage='System Console' /> - </a> + </Link> </li> ); } @@ -127,16 +127,16 @@ export default class SidebarRightMenu extends React.Component { if (global.window.mm_config.HelpLink) { helpLink = ( <li> - <a + <Link target='_blank' - href={global.window.mm_config.HelpLink} + to={global.window.mm_config.HelpLink} > <i className='fa fa-question'></i> <FormattedMessage id='sidebar_right_menu.help' defaultMessage='Help' /> - </a> + </Link> </li> ); } @@ -145,16 +145,16 @@ export default class SidebarRightMenu extends React.Component { if (global.window.mm_config.ReportAProblemLink) { reportLink = ( <li> - <a + <Link target='_blank' - href={global.window.mm_config.ReportAProblemLink} + to={global.window.mm_config.ReportAProblemLink} > <i className='fa fa-phone'></i> <FormattedMessage id='sidebar_right_menu.report' defaultMessage='Report a Problem' /> - </a> + </Link> </li> ); } @@ -164,10 +164,12 @@ export default class SidebarRightMenu extends React.Component { id='sidebar-menu' > <div className='team__header theme'> - <a + <Link className='team__name' - href='/channels/town-square' - >{teamDisplayName}</a> + to='/channels/town-square' + > + {teamDisplayName} + </Link> </div> <div className='nav-pills__container'> 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' > - <a - href={'/' + team.name} + <Link + to={'/' + team.name} > <span className='signup-team-dir__name'>{team.display_name}</span> <span className='glyphicon glyphicon-menu-right right signup-team-dir__arrow' aria-hidden='true' /> - </a> + </Link> </div> ); } 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 ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span classNameName='fa fa-chevron-left'/> <FormattedMessage id='web.header.back'/> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container'> 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 ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span className='fa fa-chevron-left'/> <FormattedMessage id='web.header.back' /> - </a> + </Link> </div> <div className='col-sm-12'> <div classNameName='signup-team__container'> 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( - <a + <Link className='btn btn-custom-login 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> @@ -329,16 +329,16 @@ class SignupUserComplete extends React.Component { defaultMessage='with GitLab' /> </span> - </a> + </Link> ); } if (global.window.mm_config.EnableSignUpWithGoogle === 'true') { signupMessage.push( - <a + <Link className='btn btn-custom-login 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> @@ -347,7 +347,7 @@ class SignupUserComplete extends React.Component { defaultMessage='with Google' /> </span> - </a> + </Link> ); } @@ -442,10 +442,10 @@ class SignupUserComplete extends React.Component { return ( <div> <div className='signup-header'> - <a href='/'> + <Link to='/'> <span classNameNameName='fa fa-chevron-left'/> <FormattedMessage id='web.header.back'/> - </a> + </Link> </div> <div className='col-sm-12'> <div className='signup-team__container padding--less'> 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 ' /> - <a - href={this.state.link} + <Link + to={this.state.link} download={true} > <FormattedMessage id='team_export_tab.download' defaultMessage='download' /> - </a> + </Link> </p> ); 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 ( <div> {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> ); } 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 { </button> {serverError} </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> ); } 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 { </a> {serverError} </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> ); } @@ -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} </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> ); } @@ -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 { <div> <h4> <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> <div className='video-div embed-responsive-item' diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 1379455ca..ac12edb82 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -17,6 +17,7 @@ import * as client from './client.jsx'; import Autolinker from 'autolinker'; import React from 'react'; +import {browserHistory} from 'react-router'; import {FormattedTime} from 'react-intl'; import icon50 from 'images/icon50x50.png'; @@ -170,7 +171,7 @@ export function notifyMe(title, body, channel) { if (channel) { switchChannel(channel); } else { - window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square'; + browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square'); } }; 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)) { errorCb(); } |