summaryrefslogtreecommitdiffstats
path: root/webapp/routes
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/routes')
-rw-r--r--webapp/routes/route_admin_console.jsx275
-rw-r--r--webapp/routes/route_claim.jsx36
-rw-r--r--webapp/routes/route_create_team.jsx25
-rw-r--r--webapp/routes/route_emoji.jsx24
-rw-r--r--webapp/routes/route_help.jsx66
-rw-r--r--webapp/routes/route_integrations.jsx117
-rw-r--r--webapp/routes/route_mfa.jsx24
-rw-r--r--webapp/routes/route_root.jsx181
-rw-r--r--webapp/routes/route_team.jsx347
-rw-r--r--webapp/routes/route_utils.jsx43
10 files changed, 0 insertions, 1138 deletions
diff --git a/webapp/routes/route_admin_console.jsx b/webapp/routes/route_admin_console.jsx
deleted file mode 100644
index 80950bc06..000000000
--- a/webapp/routes/route_admin_console.jsx
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import * as RouteUtils from 'routes/route_utils.jsx';
-import {Route, Redirect, IndexRedirect} from 'react-router/es6';
-import React from 'react';
-
-import SystemAnalytics from 'components/analytics/system_analytics.jsx';
-import ConfigurationSettings from 'components/admin_console/configuration_settings.jsx';
-import LocalizationSettings from 'components/admin_console/localization_settings.jsx';
-import UsersAndTeamsSettings from 'components/admin_console/users_and_teams_settings.jsx';
-import PrivacySettings from 'components/admin_console/privacy_settings.jsx';
-import PolicySettings from 'components/admin_console/policy_settings.jsx';
-import LogSettings from 'components/admin_console/log_settings.jsx';
-import EmailAuthenticationSettings from 'components/admin_console/email_authentication_settings.jsx';
-import GitLabSettings from 'components/admin_console/gitlab_settings.jsx';
-import OAuthSettings from 'components/admin_console/oauth_settings.jsx';
-import LdapSettings from 'components/admin_console/ldap_settings.jsx';
-import SamlSettings from 'components/admin_console/saml_settings.jsx';
-import ClusterSettings from 'components/admin_console/cluster_settings.jsx';
-import MetricsSettings from 'components/admin_console/metrics_settings.jsx';
-import SignupSettings from 'components/admin_console/signup_settings.jsx';
-import PasswordSettings from 'components/admin_console/password_settings.jsx';
-import MfaSettings from 'components/admin_console/mfa_settings.jsx';
-import PublicLinkSettings from 'components/admin_console/public_link_settings.jsx';
-import SessionSettings from 'components/admin_console/session_settings.jsx';
-import ConnectionSettings from 'components/admin_console/connection_settings.jsx';
-import ClientVersionsSettings from 'components/admin_console/client_versions_settings.jsx';
-import EmailSettings from 'components/admin_console/email_settings.jsx';
-import PushSettings from 'components/admin_console/push_settings.jsx';
-import CustomIntegrationsSettings from 'components/admin_console/custom_integrations_settings.jsx';
-import ExternalServiceSettings from 'components/admin_console/external_service_settings.jsx';
-import PluginSettings from 'components/admin_console/plugin_settings';
-import WebrtcSettings from 'components/admin_console/webrtc_settings.jsx';
-import DatabaseSettings from 'components/admin_console/database_settings.jsx';
-import StorageSettings from 'components/admin_console/storage_settings.jsx';
-import CustomBrandSettings from 'components/admin_console/custom_brand_settings.jsx';
-import CustomEmojiSettings from 'components/admin_console/custom_emoji_settings.jsx';
-import LinkPreviewsSettings from 'components/admin_console/link_previews_settings.jsx';
-import LegalAndSupportSettings from 'components/admin_console/legal_and_support_settings.jsx';
-import NativeAppLinkSettings from 'components/admin_console/native_app_link_settings.jsx';
-import ComplianceSettings from 'components/admin_console/compliance_settings.jsx';
-import RateSettings from 'components/admin_console/rate_settings.jsx';
-import DeveloperSettings from 'components/admin_console/developer_settings.jsx';
-import SystemUsers from 'components/admin_console/system_users';
-import TeamAnalytics from 'components/analytics/team_analytics';
-import LicenseSettings from 'components/admin_console/license_settings.jsx';
-import Audits from 'components/admin_console/audits';
-import Logs from 'components/admin_console/server_logs';
-import ElasticsearchSettings from 'components/admin_console/elasticsearch_settings.jsx';
-import JIRASettings from 'plugins/jira/components/settings.jsx';
-
-export default (
- <Route>
- <Route
- path='system_analytics'
- component={SystemAnalytics}
- />
- <Route path='general'>
- <IndexRedirect to='configuration'/>
- <Route
- path='configuration'
- component={ConfigurationSettings}
- />
- <Route
- path='localization'
- component={LocalizationSettings}
- />
- <Route
- path='users_and_teams'
- component={UsersAndTeamsSettings}
- />
- <Route
- path='privacy'
- component={PrivacySettings}
- />
- <Route
- path='policy'
- component={PolicySettings}
- />
- <Route
- path='compliance'
- component={ComplianceSettings}
- />
- <Route
- path='logging'
- component={LogSettings}
- />
- </Route>
- <Route path='authentication'>
- <IndexRedirect to='authentication_email'/>
- <Route
- path='authentication_email'
- component={EmailAuthenticationSettings}
- />
- <Route
- path='gitlab'
- component={GitLabSettings}
- />
- <Route
- path='oauth'
- component={OAuthSettings}
- />
- <Route
- path='ldap'
- component={LdapSettings}
- />
- <Route
- path='saml'
- component={SamlSettings}
- />
- <Route
- path='mfa'
- component={MfaSettings}
- />
- </Route>
- <Route path='security'>
- <IndexRedirect to='sign_up'/>
- <Route
- path='sign_up'
- component={SignupSettings}
- />
- <Route
- path='password'
- component={PasswordSettings}
- />
- <Route
- path='public_links'
- component={PublicLinkSettings}
- />
- <Route
- path='sessions'
- component={SessionSettings}
- />
- <Route
- path='connections'
- component={ConnectionSettings}
- />
- <Route
- path='client_versions'
- component={ClientVersionsSettings}
- />
- </Route>
- <Route path='notifications'>
- <IndexRedirect to='notifications_email'/>
- <Route
- path='notifications_email'
- component={EmailSettings}
- />
- <Route
- path='push'
- component={PushSettings}
- />
- </Route>
- <Route path='integrations'>
- <IndexRedirect to='custom'/>
- <Route
- path='custom'
- component={CustomIntegrationsSettings}
- />
- <Route
- path='external'
- component={ExternalServiceSettings}
- />
- <Route
- path='webrtc'
- component={WebrtcSettings}
- />
- <Route
- path='jira'
- component={JIRASettings}
- />
- <Route
- path='plugins'
- component={PluginSettings}
- />
- </Route>
- <Route path='files'>
- <IndexRedirect to='storage'/>
- <Route
- path='storage'
- component={StorageSettings}
- />
- </Route>
- <Route path='customization'>
- <IndexRedirect to='custom_brand'/>
- <Route
- path='custom_brand'
- component={CustomBrandSettings}
- />
- <Route
- path='emoji'
- component={CustomEmojiSettings}
- />
- <Route
- path='link_previews'
- component={LinkPreviewsSettings}
- />
- <Route
- path='legal_and_support'
- component={LegalAndSupportSettings}
- />
- <Route
- path='native_app_links'
- component={NativeAppLinkSettings}
- />
- </Route>
- <Route path='advanced'>
- <IndexRedirect to='rate'/>
- <Route
- path='rate'
- component={RateSettings}
- />
- <Route
- path='database'
- component={DatabaseSettings}
- />
- <Route
- path='elasticsearch'
- component={ElasticsearchSettings}
- />
- <Route
- path='developer'
- component={DeveloperSettings}
- />
- <Route
- path='cluster'
- component={ClusterSettings}
- />
- <Route
- path='metrics'
- component={MetricsSettings}
- />
- </Route>
- <Route
- path='users'
- component={SystemUsers}
- />
- <Route
- path='team_analytics'
- component={TeamAnalytics}
- />
- <Route path='team'>
- <Redirect
- from=':team'
- to='../users'
- />
- <Redirect
- from=':team/users'
- to='../users'
- />
- <Redirect
- from=':team/analytics'
- to='../team_analytics'
- />
- <Redirect
- from='*'
- to='/error'
- query={RouteUtils.notFoundParams}
- />
- </Route>
- <Route
- path='license'
- component={LicenseSettings}
- />
- <Route
- path='audits'
- component={Audits}
- />
- <Route
- path='logs'
- component={Logs}
- />
- </Route>
-);
diff --git a/webapp/routes/route_claim.jsx b/webapp/routes/route_claim.jsx
deleted file mode 100644
index 02dfeb8e8..000000000
--- a/webapp/routes/route_claim.jsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-export default {
- path: 'claim',
- getComponents: (location, callback) => {
- System.import('components/claim/claim_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- path: 'oauth_to_email',
- getComponents: (location, callback) => {
- System.import('components/claim/components/oauth_to_email.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'email_to_oauth',
- getComponents: (location, callback) => {
- System.import('components/claim/components/email_to_oauth.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'ldap_to_email',
- getComponents: (location, callback) => {
- System.import('components/claim/components/ldap_to_email.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'email_to_ldap',
- getComponents: (location, callback) => {
- System.import('components/claim/components/email_to_ldap.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- )
-};
diff --git a/webapp/routes/route_create_team.jsx b/webapp/routes/route_create_team.jsx
deleted file mode 100644
index 354d7a39c..000000000
--- a/webapp/routes/route_create_team.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-export default {
- path: 'create_team',
- getComponents: (location, callback) => {
- System.import('components/create_team/create_team_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- indexRoute: {onEnter: (nextState, replace) => replace('/create_team/display_name')},
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- path: 'display_name',
- getComponents: (location, callback) => {
- System.import('components/create_team/components/display_name.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'team_url',
- getComponents: (location, callback) => {
- System.import('components/create_team/components/team_url.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- )
-};
diff --git a/webapp/routes/route_emoji.jsx b/webapp/routes/route_emoji.jsx
deleted file mode 100644
index 2718a428e..000000000
--- a/webapp/routes/route_emoji.jsx
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-export default {
- path: 'emoji',
- getComponents: (location, callback) => {
- System.import('components/backstage/backstage_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/emoji/components/emoji_list.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- childRoutes: [
- {
- path: 'add',
- getComponents: (location, callback) => {
- System.import('components/emoji/components/add_emoji.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
-};
diff --git a/webapp/routes/route_help.jsx b/webapp/routes/route_help.jsx
deleted file mode 100644
index 7c0ad2dd1..000000000
--- a/webapp/routes/route_help.jsx
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-export default {
- path: 'help',
- indexRoute: {onEnter: (nextState, replace) => replace('/help/messaging')},
- childRoutes: [
- {
- getComponents: (location, callback) => {
- System.import('components/help/help_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- childRoutes: [
- {
- path: 'messaging',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/help/components/messaging.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- },
- {
- path: 'composing',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/help/components/composing.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- },
- {
- path: 'mentioning',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/help/components/mentioning.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- },
- {
- path: 'formatting',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/help/components/formatting.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- },
- {
- path: 'attaching',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/help/components/attaching.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- },
- {
- path: 'commands',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/help/components/commands.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- }
- ]
- }
- ]
-};
diff --git a/webapp/routes/route_integrations.jsx b/webapp/routes/route_integrations.jsx
deleted file mode 100644
index 13abeb869..000000000
--- a/webapp/routes/route_integrations.jsx
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-export default {
- path: 'integrations',
- getComponents: (location, callback) => {
- System.import('components/backstage/backstage_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/integrations/components/integrations.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- childRoutes: [
- {
- path: 'incoming_webhooks',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/integrations/components/installed_incoming_webhooks.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- childRoutes: [
- {
- path: 'add',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/add_incoming_webhook').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'edit',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/edit_incoming_webhook').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- },
- {
- path: 'outgoing_webhooks',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/integrations/components/installed_outgoing_webhooks.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- childRoutes: [
- {
- path: 'add',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/add_outgoing_webhook').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'edit',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/edit_outgoing_webhook').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- },
- {
- path: 'commands',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/commands_container').then(RouteUtils.importComponentSuccess(callback));
- },
- indexRoute: {onEnter: (nextState, replace) => replace(nextState.location.pathname + '/installed')},
- childRoutes: [
- {
- path: 'installed',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/installed_commands').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'add',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/add_command').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'edit',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/edit_command').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'confirm',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/confirm_integration').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- },
- {
- path: 'oauth2-apps',
- indexRoute: {
- getComponents: (location, callback) => {
- System.import('components/integrations/components/installed_oauth_apps').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- childRoutes: [
- {
- path: 'add',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/add_oauth_app').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- },
- {
- path: 'confirm',
- getComponents: (location, callback) => {
- System.import('components/integrations/components/confirm_integration').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
-};
diff --git a/webapp/routes/route_mfa.jsx b/webapp/routes/route_mfa.jsx
deleted file mode 100644
index 517d3802e..000000000
--- a/webapp/routes/route_mfa.jsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-export default {
- path: 'mfa',
- getComponents: (location, callback) => {
- System.import('components/mfa/mfa_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- path: 'setup',
- getComponents: (location, callback) => {
- System.import('components/mfa/components/setup.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'confirm',
- getComponents: (location, callback) => {
- System.import('components/mfa/components/confirm.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- }
- ]
- )
-};
diff --git a/webapp/routes/route_root.jsx b/webapp/routes/route_root.jsx
deleted file mode 100644
index 8a1f440be..000000000
--- a/webapp/routes/route_root.jsx
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import * as RouteUtils from 'routes/route_utils.jsx';
-
-import Root from 'components/root.jsx';
-
-import claimAccountRoute from 'routes/route_claim.jsx';
-import mfaRoute from 'routes/route_mfa.jsx';
-import createTeamRoute from 'routes/route_create_team.jsx';
-import teamRoute from 'routes/route_team.jsx';
-import helpRoute from 'routes/route_help.jsx';
-
-import BrowserStore from 'stores/browser_store.jsx';
-import ErrorStore from 'stores/error_store.jsx';
-import * as UserAgent from 'utils/user_agent.jsx';
-
-import {browserHistory} from 'react-router/es6';
-
-function preLogin(nextState, replace, callback) {
- // redirect to the mobile landing page if the user hasn't seen it before
- if (window.mm_config.IosAppDownloadLink && UserAgent.isIosWeb() && !BrowserStore.hasSeenLandingPage()) {
- replace('/get_ios_app');
- BrowserStore.setLandingPageSeen(true);
- } else if (window.mm_config.AndroidAppDownloadLink && UserAgent.isAndroidWeb() && !BrowserStore.hasSeenLandingPage()) {
- replace('/get_android_app');
- BrowserStore.setLandingPageSeen(true);
- }
-
- callback();
-}
-
-function preLoggedIn(nextState, replace, callback) {
- if (RouteUtils.checkIfMFARequired(nextState)) {
- browserHistory.push('/mfa/setup');
- return;
- }
-
- ErrorStore.clearLastError();
- callback();
-}
-
-export default {
- path: '/',
- component: Root,
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- getComponents: (location, callback) => {
- System.import('components/header_footer_template.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- path: 'login',
- onEnter: preLogin,
- getComponents: (location, callback) => {
- System.import('components/login/login_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'reset_password',
- getComponents: (location, callback) => {
- System.import('components/password_reset_send_link.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'reset_password_complete',
- getComponents: (location, callback) => {
- System.import('components/password_reset_form.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- claimAccountRoute,
- {
- path: 'signup_user_complete',
- getComponents: (location, callback) => {
- System.import('components/signup/signup_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'signup_email',
- getComponents: (location, callback) => {
- System.import('components/signup/components/signup_email.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'signup_ldap',
- getComponents: (location, callback) => {
- System.import('components/signup/components/signup_ldap.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'should_verify_email',
- getComponents: (location, callback) => {
- System.import('components/should_verify_email.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'do_verify_email',
- getComponents: (location, callback) => {
- System.import('components/do_verify_email.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- helpRoute
- ]
- )
- },
- {
- path: 'get_ios_app',
- getComponents: (location, callback) => {
- System.import('components/get_ios_app/get_ios_app.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'get_android_app',
- getComponents: (location, callback) => {
- System.import('components/get_android_app/get_android_app.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: 'error',
- getComponents: (location, callback) => {
- System.import('components/error_page').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- getComponents: (location, callback) => {
- System.import('components/logged_in.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- onEnter: preLoggedIn,
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- path: 'admin_console',
- getComponents: (location, callback) => {
- System.import('components/admin_console').then(RouteUtils.importComponentSuccess(callback));
- },
- indexRoute: {onEnter: (nextState, replace) => replace('/admin_console/system_analytics')},
- getChildRoutes: (location, callback) => {
- System.import('routes/route_admin_console.jsx').then((comp) => callback(null, comp.default));
- }
- },
- {
- getComponents: (location, callback) => {
- System.import('components/header_footer_template.jsx').then(RouteUtils.importComponentSuccess(callback));
- },
- getChildRoutes: RouteUtils.createGetChildComponentsFunction(
- [
- {
- path: 'select_team',
- getComponents: (location, callback) => {
- System.import('components/select_team').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- {
- path: '*authorize',
- getComponents: (location, callback) => {
- System.import('components/authorize.jsx').then(RouteUtils.importComponentSuccess(callback));
- }
- },
- createTeamRoute
- ]
- )
- },
- teamRoute,
- mfaRoute
- ]
- )
- },
- {
- path: '*',
- onEnter: (nextState, replace) => {
- replace({
- pathname: 'error',
- query: RouteUtils.notFoundParams
- });
- }
- }
- ]
- )
-};
diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx
deleted file mode 100644
index 59cf6d673..000000000
--- a/webapp/routes/route_team.jsx
+++ /dev/null
@@ -1,347 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import $ from 'jquery';
-import * as RouteUtils from 'routes/route_utils.jsx';
-import {browserHistory} from 'react-router/es6';
-
-import TeamStore from 'stores/team_store.jsx';
-import UserStore from 'stores/user_store.jsx';
-import * as GlobalActions from 'actions/global_actions.jsx';
-import {loadStatusesForChannelAndSidebar} from 'actions/status_actions.jsx';
-import {openDirectChannelToUser} from 'actions/channel_actions.jsx';
-import {reconnect} from 'actions/websocket_actions.jsx';
-import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
-import Constants from 'utils/constants.jsx';
-const ActionTypes = Constants.ActionTypes;
-import ChannelStore from 'stores/channel_store.jsx';
-import BrowserStore from 'stores/browser_store.jsx';
-import * as Utils from 'utils/utils.jsx';
-
-import emojiRoute from 'routes/route_emoji.jsx';
-import integrationsRoute from 'routes/route_integrations.jsx';
-
-import {loadNewDMIfNeeded, loadNewGMIfNeeded, loadProfilesForSidebar} from 'actions/user_actions.jsx';
-
-// Redux actions
-import store from 'stores/redux_store.jsx';
-const dispatch = store.dispatch;
-const getState = store.getState;
-
-import {fetchMyChannelsAndMembers, joinChannel} from 'mattermost-redux/actions/channels';
-import {getMyTeamUnreads} from 'mattermost-redux/actions/teams';
-import {getUser, getUserByUsername, getUserByEmail} from 'mattermost-redux/actions/users';
-
-function onChannelEnter(nextState, replace, callback) {
- doChannelChange(nextState, replace, callback);
-}
-
-function doChannelChange(state, replace, callback) {
- let channel;
- if (state.location.query.fakechannel) {
- channel = JSON.parse(state.location.query.fakechannel);
- } else {
- channel = ChannelStore.getByName(state.params.channel);
-
- if (channel && channel.type === Constants.DM_CHANNEL) {
- loadNewDMIfNeeded(channel.id);
- } else if (channel && channel.type === Constants.GM_CHANNEL) {
- loadNewGMIfNeeded(channel.id);
- }
-
- if (!channel) {
- joinChannel(UserStore.getCurrentId(), TeamStore.getCurrentId(), null, state.params.channel)(dispatch, getState).then(
- (result) => {
- if (result.data) {
- GlobalActions.emitChannelClickEvent(result.data.channel);
- } else if (result.error) {
- if (state.params.team) {
- replace('/' + state.params.team + '/channels/town-square');
- } else {
- replace('/');
- }
- }
- callback();
- }
- );
- return;
- }
- }
- GlobalActions.emitChannelClickEvent(channel);
- callback();
-}
-
-let wakeUpInterval;
-let lastTime = (new Date()).getTime();
-const WAKEUP_CHECK_INTERVAL = 30000; // 30 seconds
-const WAKEUP_THRESHOLD = 60000; // 60 seconds
-
-function preNeedsTeam(nextState, replace, callback) {
- if (RouteUtils.checkIfMFARequired(nextState)) {
- browserHistory.push('/mfa/setup');
- return;
- }
-
- clearInterval(wakeUpInterval);
-
- wakeUpInterval = setInterval(() => {
- const currentTime = (new Date()).getTime();
- if (currentTime > (lastTime + WAKEUP_THRESHOLD)) { // ignore small delays
- console.log('computer woke up - fetching latest'); //eslint-disable-line no-console
- reconnect(false);
- }
- lastTime = currentTime;
- }, WAKEUP_CHECK_INTERVAL);
-
- // First check to make sure you're in the current team
- // for the current url.
- const teamName = nextState.params.team;
- const team = TeamStore.getByName(teamName);
-
- if (!team) {
- browserHistory.push('/?redirect_to=' + encodeURIComponent(nextState.location.pathname));
- return;
- }
-
- // If current team is set, then this is not first load
- // The first load action pulls team unreads
- if (TeamStore.getCurrentId()) {
- getMyTeamUnreads()(dispatch, getState);
- }
-
- TeamStore.saveMyTeam(team);
- BrowserStore.setGlobalItem('team', team.id);
- TeamStore.emitChange();
- GlobalActions.emitCloseRightHandSide();
-
- const d1 = $.Deferred(); //eslint-disable-line new-cap
-
- fetchMyChannelsAndMembers(team.id)(dispatch, getState).then(
- () => {
- loadStatusesForChannelAndSidebar();
- loadProfilesForSidebar();
-
- d1.resolve();
- }
- );
-
- $.when(d1).done(() => {
- callback();
- });
-}
-
-function selectLastChannel(nextState, replace, callback) {
- const team = TeamStore.getByName(nextState.params.team);
- const channelId = BrowserStore.getGlobalItem(team.id);
- const channel = ChannelStore.getChannelById(channelId);
-
- let channelName = 'town-square';
- if (channel) {
- channelName = channel.name;
- }
-
- replace(`/${team.name}/channels/${channelName}`);
- callback();
-}
-
-function onPermalinkEnter(nextState, replace, callback) {
- const postId = nextState.params.postid;
- GlobalActions.emitPostFocusEvent(
- postId,
- () => callback()
- );
-}
-
-/**
-* identifier may either be:
-* - A DM user_id length 26 chars
-* - A DM channel_id (id1_id2) length 54 chars
-* - A GM generated_id length 40 chars
-* - A username that starts with an @ sign
-* - An email containing an @ sign
-**/
-function onChannelByIdentifierEnter(state, replace, callback) {
- const {identifier} = state.params;
- if (identifier.indexOf('@') === -1) {
- // DM user_id or id1_id2 identifier
- if (identifier.length === 26 || identifier.length === 54) {
- const userId = (identifier.length === 26) ? identifier : Utils.getUserIdFromChannelId(identifier);
- const teammate = UserStore.getProfile(userId);
- if (teammate) {
- replace(`/${state.params.team}/messages/@${teammate.username}`);
- callback();
- } else {
- getUser(userId)(dispatch, getState).then(
- (profile) => {
- if (profile) {
- replace(`/${state.params.team}/messages/@${profile.username}`);
- callback();
- } else if (profile == null) {
- handleError(state, replace, callback);
- }
- }
- );
- }
-
- // GM generated_id identifier
- } else if (identifier.length === 40) {
- const channel = ChannelStore.getByName(identifier);
- if (channel) {
- loadNewGMIfNeeded(channel.id);
- GlobalActions.emitChannelClickEvent(channel);
- callback();
- } else {
- joinChannel(UserStore.getCurrentId(), TeamStore.getCurrentId(), null, identifier)(dispatch, getState).then(
- (result) => {
- if (result.data) {
- GlobalActions.emitChannelClickEvent(result.data.channel);
- callback();
- } else if (result.error) {
- handleError(state, replace, callback);
- }
- }
- );
- }
- } else {
- handleError(state, replace, callback);
- }
- } else {
- function success(profile) {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILE,
- profile
- });
- directChannelToUser(profile, state, replace, callback);
- }
-
- function error() {
- handleError(state, replace, callback);
- }
-
- if (identifier.indexOf('@') === 0) { // @username identifier
- const username = identifier.slice(1, identifier.length);
- const teammate = UserStore.getProfileByUsername(username);
- if (teammate) {
- directChannelToUser(teammate, state, replace, callback);
- } else {
- getUserByUsername(username)(dispatch, getState).then(
- (data) => {
- if (data && success) {
- success(data);
- } else if (data == null && error) {
- const serverError = getState().requests.users.getUserByUsername.error;
- error({id: serverError.server_error_id, ...serverError});
- }
- }
- );
- }
- } else if (identifier.indexOf('@') > 0) { // email identifier
- const email = identifier;
- const teammate = UserStore.getProfileByEmail(email);
- if (teammate) {
- directChannelToUser(teammate, state, replace, callback);
- } else {
- getUserByEmail(email)(dispatch, getState).then(
- (data) => {
- if (data && success) {
- success(data);
- } else if (data == null && error) {
- const serverError = getState().requests.users.getUser.error;
- error({id: serverError.server_error_id, ...serverError});
- }
- }
- );
- }
- }
- }
-}
-
-function directChannelToUser(profile, state, replace, callback) {
- openDirectChannelToUser(
- profile.id,
- (channel) => {
- GlobalActions.emitChannelClickEvent(channel);
- callback();
- },
- () => {
- handleError(state, replace, callback);
- }
- );
-}
-
-function handleError(state, replace, callback) {
- if (state.params.team) {
- replace(`/${state.params.team}/channels/${Constants.DEFAULT_CHANNEL}`);
- } else {
- replace('/');
- }
- callback();
-}
-
-export default {
- path: ':team',
- onEnter: preNeedsTeam,
- indexRoute: {onEnter: selectLastChannel},
- childRoutes: [
- integrationsRoute,
- emojiRoute,
- {
- getComponents: (location, callback) => {
- System.import('components/needs_team').then(RouteUtils.importComponentSuccess(callback));
- },
- childRoutes: [
- {
- path: 'channels/:channel',
- onEnter: onChannelEnter,
- getComponents: (location, callback) => {
- Promise.all([
- System.import('components/team_sidebar'),
- System.import('components/sidebar.jsx'),
- System.import('components/channel_view.jsx')
- ]).then(
- (comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
- );
- }
- },
- {
- path: 'pl/:postid',
- onEnter: onPermalinkEnter,
- getComponents: (location, callback) => {
- Promise.all([
- System.import('components/team_sidebar'),
- System.import('components/sidebar.jsx'),
- System.import('components/permalink_view.jsx')
- ]).then(
- (comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
- );
- }
- },
- {
- path: 'messages/:identifier',
- onEnter: onChannelByIdentifierEnter,
- getComponents: (location, callback) => {
- Promise.all([
- System.import('components/team_sidebar'),
- System.import('components/sidebar.jsx'),
- System.import('components/channel_view.jsx')
- ]).then(
- (comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
- );
- }
- },
- {
- path: 'tutorial',
- getComponents: (location, callback) => {
- Promise.all([
- System.import('components/team_sidebar'),
- System.import('components/sidebar.jsx'),
- System.import('components/tutorial/tutorial_view.jsx')
- ]).then(
- (comarr) => callback(null, {team_sidebar: comarr[0].default, sidebar: comarr[1].default, center: comarr[2].default})
- );
- }
- }
- ]
- }
- ]
-};
diff --git a/webapp/routes/route_utils.jsx b/webapp/routes/route_utils.jsx
deleted file mode 100644
index 17fdc291d..000000000
--- a/webapp/routes/route_utils.jsx
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import UserStore from 'stores/user_store.jsx';
-import {ErrorPageTypes} from 'utils/constants.jsx';
-
-export function importComponentSuccess(callback) {
- return (comp) => callback(null, comp.default);
-}
-
-export function createGetChildComponentsFunction(arrayOfComponents) {
- return (locaiton, callback) => callback(null, arrayOfComponents);
-}
-
-export const notFoundParams = {
- type: ErrorPageTypes.PAGE_NOT_FOUND
-};
-
-const mfaPaths = [
- '/mfa/setup',
- '/mfa/confirm'
-];
-
-const mfaAuthServices = [
- '',
- 'email',
- 'ldap'
-];
-
-export function checkIfMFARequired(state) {
- if (window.mm_license.MFA === 'true' &&
- window.mm_config.EnableMultifactorAuthentication === 'true' &&
- window.mm_config.EnforceMultifactorAuthentication === 'true' &&
- mfaPaths.indexOf(state.location.pathname) === -1) {
- const user = UserStore.getCurrentUser();
- if (user && !user.mfa_active &&
- mfaAuthServices.indexOf(user.auth_service) !== -1) {
- return true;
- }
- }
-
- return false;
-}