diff --git a/webapp/channels/src/packages/mattermost-redux/src/action_types/general.ts b/webapp/channels/src/packages/mattermost-redux/src/action_types/general.ts index ea3b7662077..50fb6b29f5a 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/action_types/general.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/action_types/general.ts @@ -4,8 +4,6 @@ import keyMirror from 'mattermost-redux/utils/key_mirror'; export default keyMirror({ - PING_RESET: null, - RECEIVED_SERVER_VERSION: null, CLIENT_CONFIG_RECEIVED: null, diff --git a/webapp/channels/src/packages/mattermost-redux/src/actions/general.test.ts b/webapp/channels/src/packages/mattermost-redux/src/actions/general.test.ts index b2f557f4d30..c46e21ff320 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/actions/general.test.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/actions/general.test.ts @@ -10,10 +10,6 @@ import {Client4} from 'mattermost-redux/client'; import TestHelper from '../../test/test_helper'; import configureStore from '../../test/test_store'; -import {ActionResult} from 'mattermost-redux/types/actions'; - -import {FormattedError} from './helpers'; - const OK_RESPONSE = {status: 'OK'}; describe('Actions.General', () => { @@ -30,40 +26,6 @@ describe('Actions.General', () => { TestHelper.tearDown(); }); - it('getPing - Invalid URL', async () => { - const serverUrl = Client4.getUrl(); - Client4.setUrl('notarealurl'); - - const pingError = new FormattedError( - 'mobile.server_ping_failed', - 'Cannot connect to the server. Please check your server URL and internet connection.', - ); - - nock(Client4.getBaseRoute()). - get('/system/ping'). - query(true). - reply(401, {error: 'ping error', code: 401}); - - const {error} = await Actions.getPing()(store.dispatch, store.getState) as ActionResult; - Client4.setUrl(serverUrl); - expect(error).toEqual(pingError); - }); - - it('getPing', async () => { - const response = { - status: 'OK', - version: '4.0.0', - }; - - nock(Client4.getBaseRoute()). - get('/system/ping'). - query(true). - reply(200, response); - - const {data} = await Actions.getPing()(store.dispatch, store.getState) as ActionResult; - expect(data).toEqual(response); - }); - it('getClientConfig', async () => { nock(Client4.getBaseRoute()). get('/config/client'). diff --git a/webapp/channels/src/packages/mattermost-redux/src/actions/general.ts b/webapp/channels/src/packages/mattermost-redux/src/actions/general.ts index a05b5445f97..e3fa85dede8 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/actions/general.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/actions/general.ts @@ -14,40 +14,7 @@ import {GetStateFunc, DispatchFunc, ActionFunc} from 'mattermost-redux/types/act import {logError} from './errors'; import {loadRolesIfNeeded} from './roles'; -import {bindClientFunc, forceLogoutIfNecessary, FormattedError} from './helpers'; - -export function getPing(): ActionFunc { - return async () => { - let data; - let pingError = new FormattedError( - 'mobile.server_ping_failed', - 'Cannot connect to the server. Please check your server URL and internet connection.', - ); - try { - data = await Client4.ping(); - if (data.status !== 'OK') { - // successful ping but not the right return {data} - return {error: pingError}; - } - } catch (error) { // ServerError - if (error.status_code === 401) { - // When the server requires a client certificate to connect. - pingError = error; - } - return {error: pingError}; - } - - return {data}; - }; -} - -export function resetPing(): ActionFunc { - return async (dispatch: DispatchFunc) => { - dispatch({type: GeneralTypes.PING_RESET, data: {}}); - - return {data: true}; - }; -} +import {bindClientFunc, forceLogoutIfNecessary} from './helpers'; export function getClientConfig(): ActionFunc { return async (dispatch: DispatchFunc, getState: GetStateFunc) => { @@ -210,7 +177,6 @@ export function getFirstAdminSetupComplete(): ActionFunc { } export default { - getPing, getClientConfig, getDataRetentionPolicy, getLicenseConfig,