Enable import order (#24091)

* Enable import order

* Add new order groups and add consistent-type-imports

* Remove types group, move react to top and fix issues

* Add store and reducers to the redux group and move imports from types folder to the end

* Fix tsc

* Remove react rule

* Fix test

* Fix eslint disable
This commit is contained in:
Daniel Espino García 2023-09-06 12:51:55 +02:00 committed by GitHub
parent b2f36c7cdf
commit d13429aa92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2342 changed files with 12353 additions and 11153 deletions

View File

@ -37,19 +37,50 @@
"eol-last": ["error", "always"], "eol-last": ["error", "always"],
"import/no-unresolved": 2, "import/no-unresolved": 2,
"import/order": [ "import/order": [
0, 2,
{ {
"newlines-between": "always-and-inside-groups", "newlines-between": "always",
"groups": [ "groups": [
"builtin", "builtin",
"external", "external",
[ "internal",
"internal",
"parent"
],
"sibling", "sibling",
"parent",
"index" "index"
] ],
"pathGroups": [
{
"pattern": "@mattermost/**",
"group": "external",
"position": "after"
},
{
"pattern": "mattermost-redux/**",
"group": "external",
"position": "after"
},
{
"pattern": "@(selectors|actions|stores|store|reducers){,/**}",
"group": "external",
"position": "after"
},
{
"pattern": "components/**",
"group": "external",
"position": "after"
},
{
"pattern": "types{,/**}",
"group": "internal",
"position": "after"
}
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"distinctGroup": true,
"pathGroupsExcludedImportTypes": ["builtin"]
} }
], ],
"no-undefined": 0, "no-undefined": 0,
@ -95,7 +126,8 @@
} }
], ],
"max-lines": ["warn", {"max": 800, "skipBlankLines": true, "skipComments": true}], "max-lines": ["warn", {"max": 800, "skipBlankLines": true, "skipComments": true}],
"formatjs/no-multiple-whitespaces": 2 "formatjs/no-multiple-whitespaces": 2,
"@typescript-eslint/consistent-type-imports": ["error", {"disallowTypeAnnotations": false}]
}, },
"overrides": [ "overrides": [
{ {

View File

@ -2,16 +2,16 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import * as AdminActions from 'mattermost-redux/actions/admin'; import * as AdminActions from 'mattermost-redux/actions/admin';
import * as UserActions from 'mattermost-redux/actions/users';
import * as TeamActions from 'mattermost-redux/actions/teams';
import {Client4} from 'mattermost-redux/client';
import {bindClientFunc} from 'mattermost-redux/actions/helpers'; import {bindClientFunc} from 'mattermost-redux/actions/helpers';
import * as TeamActions from 'mattermost-redux/actions/teams';
import {trackEvent} from 'actions/telemetry_actions.jsx'; import * as UserActions from 'mattermost-redux/actions/users';
import {Client4} from 'mattermost-redux/client';
import {emitUserLoggedOutEvent} from 'actions/global_actions'; import {emitUserLoggedOutEvent} from 'actions/global_actions';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import {getOnNavigationConfirmed} from 'selectors/views/admin'; import {getOnNavigationConfirmed} from 'selectors/views/admin';
import store from 'stores/redux_store.jsx'; import store from 'stores/redux_store.jsx';
import {ActionTypes} from 'utils/constants'; import {ActionTypes} from 'utils/constants';
const dispatch = store.dispatch; const dispatch = store.dispatch;

View File

@ -1,23 +1,23 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import type {AppCallResponse, AppForm, AppCallRequest, AppContext, AppBinding} from '@mattermost/types/apps';
import type {CommandArgs} from '@mattermost/types/integrations';
import type {Post} from '@mattermost/types/posts';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {Action, ActionFunc, DispatchFunc} from 'mattermost-redux/types/actions';
import {AppCallResponse, AppForm, AppCallRequest, AppContext, AppBinding} from '@mattermost/types/apps';
import {AppCallResponseTypes} from 'mattermost-redux/constants/apps'; import {AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import {Post} from '@mattermost/types/posts'; import type {Action, ActionFunc, DispatchFunc} from 'mattermost-redux/types/actions';
import {CommandArgs} from '@mattermost/types/integrations'; import {cleanForm} from 'mattermost-redux/utils/apps';
import {openModal} from 'actions/views/modals'; import {openModal} from 'actions/views/modals';
import AppsForm from 'components/apps_form'; import AppsForm from 'components/apps_form';
import {createCallRequest, makeCallErrorResponse} from 'utils/apps';
import {getHistory} from 'utils/browser_history';
import {ModalIdentifiers} from 'utils/constants'; import {ModalIdentifiers} from 'utils/constants';
import {getSiteURL, shouldOpenInNewTab} from 'utils/url'; import {getSiteURL, shouldOpenInNewTab} from 'utils/url';
import {getHistory} from 'utils/browser_history';
import {createCallRequest, makeCallErrorResponse} from 'utils/apps';
import {cleanForm} from 'mattermost-redux/utils/apps';
import {sendEphemeralPost} from './global_actions'; import {sendEphemeralPost} from './global_actions';
@ -114,9 +114,7 @@ export function doAppSubmit<Res=unknown>(inCall: AppCallRequest, intl: any): Act
window.open(res.navigate_to_url); window.open(res.navigate_to_url);
return {data: res}; return {data: res};
} }
const navigateURL = res.navigate_to_url.startsWith(getSiteURL()) ? const navigateURL = res.navigate_to_url.startsWith(getSiteURL()) ? res.navigate_to_url.slice(getSiteURL().length) : res.navigate_to_url;
res.navigate_to_url.slice(getSiteURL().length) :
res.navigate_to_url;
getHistory().push(navigateURL); getHistory().push(navigateURL);
return {data: res}; return {data: res};
} }

View File

@ -3,6 +3,13 @@
import nock from 'nock'; import nock from 'nock';
import type {Channel} from '@mattermost/types/channels';
import type {Role} from '@mattermost/types/roles';
import type {Team} from '@mattermost/types/teams';
import type {UserProfile} from '@mattermost/types/users';
import {Client4} from 'mattermost-redux/client';
import { import {
searchMoreChannels, searchMoreChannels,
addUsersToChannel, addUsersToChannel,
@ -10,18 +17,12 @@ import {
openGroupChannelToUserIds, openGroupChannelToUserIds,
loadChannelsForCurrentUser, fetchChannelsAndMembers, loadChannelsForCurrentUser, fetchChannelsAndMembers,
} from 'actions/channel_actions'; } from 'actions/channel_actions';
import {loadProfilesForSidebar} from 'actions/user_actions';
import {CHANNELS_AND_CHANNEL_MEMBERS_PER_PAGE} from 'actions/channel_queries'; import {CHANNELS_AND_CHANNEL_MEMBERS_PER_PAGE} from 'actions/channel_queries';
import {loadProfilesForSidebar} from 'actions/user_actions';
import configureStore from 'store';
import {Channel} from '@mattermost/types/channels';
import {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users';
import {Role} from '@mattermost/types/roles';
import {Client4} from 'mattermost-redux/client';
import TestHelper from 'packages/mattermost-redux/test/test_helper'; import TestHelper from 'packages/mattermost-redux/test/test_helper';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import configureStore from 'store';
const initialState = { const initialState = {
entities: { entities: {

View File

@ -3,34 +3,35 @@
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {UserProfile} from '@mattermost/types/users'; import type {Channel, ChannelMembership, ServerChannel} from '@mattermost/types/channels';
import {Channel, ChannelMembership, ServerChannel} from '@mattermost/types/channels'; import type {ServerError} from '@mattermost/types/errors';
import {Team} from '@mattermost/types/teams'; import type {Role} from '@mattermost/types/roles';
import {ServerError} from '@mattermost/types/errors'; import type {Team} from '@mattermost/types/teams';
import {Role} from '@mattermost/types/roles'; import type {UserProfile} from '@mattermost/types/users';
import {Client4} from 'mattermost-redux/client';
import {ChannelTypes, PreferenceTypes, RoleTypes} from 'mattermost-redux/action_types'; import {ChannelTypes, PreferenceTypes, RoleTypes} from 'mattermost-redux/action_types';
import * as ChannelActions from 'mattermost-redux/actions/channels'; import * as ChannelActions from 'mattermost-redux/actions/channels';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {ActionFunc} from 'mattermost-redux/types/actions';
import {logError} from 'mattermost-redux/actions/errors'; import {logError} from 'mattermost-redux/actions/errors';
import {getMyChannelMemberships} from 'mattermost-redux/selectors/entities/common'; import {savePreferences} from 'mattermost-redux/actions/preferences';
import {Client4} from 'mattermost-redux/client';
import {getChannelByName, getUnreadChannelIds, getChannel} from 'mattermost-redux/selectors/entities/channels'; import {getChannelByName, getUnreadChannelIds, getChannel} from 'mattermost-redux/selectors/entities/channels';
import {getMyChannelMemberships} from 'mattermost-redux/selectors/entities/common';
import {getCurrentTeamUrl, getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentTeamUrl, getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {ActionFunc} from 'mattermost-redux/types/actions';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import {loadNewDMIfNeeded, loadNewGMIfNeeded, loadProfilesForSidebar} from 'actions/user_actions';
import { import {
getChannelsAndChannelMembersQueryString, getChannelsAndChannelMembersQueryString,
transformToReceivedChannelsReducerPayload, transformToReceivedChannelsReducerPayload,
transformToReceivedChannelMembersReducerPayload, transformToReceivedChannelMembersReducerPayload,
ChannelsAndChannelMembersQueryResponseType,
GraphQLChannel,
GraphQLChannelMember,
CHANNELS_AND_CHANNEL_MEMBERS_PER_PAGE, CHANNELS_AND_CHANNEL_MEMBERS_PER_PAGE,
} from 'actions/channel_queries'; } from 'actions/channel_queries';
import type {
ChannelsAndChannelMembersQueryResponseType,
GraphQLChannel,
GraphQLChannelMember} from 'actions/channel_queries';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import {loadNewDMIfNeeded, loadNewGMIfNeeded, loadProfilesForSidebar} from 'actions/user_actions';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import {Constants, Preferences, NotificationLevels} from 'utils/constants'; import {Constants, Preferences, NotificationLevels} from 'utils/constants';

View File

@ -1,10 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {ChannelMembership, ServerChannel, ChannelType} from '@mattermost/types/channels'; import type {ChannelMembership, ServerChannel, ChannelType} from '@mattermost/types/channels';
import {Role} from '@mattermost/types/roles'; import type {Role} from '@mattermost/types/roles';
import {Team} from '@mattermost/types/teams'; import type {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users'; import type {UserProfile} from '@mattermost/types/users';
import {convertRolesNamesArrayToString} from 'mattermost-redux/actions/roles'; import {convertRolesNamesArrayToString} from 'mattermost-redux/actions/roles';

View File

@ -1,22 +1,24 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Stripe} from '@stripe/stripe-js'; import type {Stripe} from '@stripe/stripe-js';
import {getCode} from 'country-list'; import {getCode} from 'country-list';
import type {Address, Feedback, WorkspaceDeletionRequest} from '@mattermost/types/cloud';
import {CloudTypes} from 'mattermost-redux/action_types';
import {getCloudCustomer, getCloudProducts, getCloudSubscription, getInvoices} from 'mattermost-redux/actions/cloud'; import {getCloudCustomer, getCloudProducts, getCloudSubscription, getInvoices} from 'mattermost-redux/actions/cloud';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {getCloudErrors} from 'mattermost-redux/selectors/entities/cloud'; import {getCloudErrors} from 'mattermost-redux/selectors/entities/cloud';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getConfirmCardSetup} from 'components/payment_form/stripe';
import {trackEvent} from 'actions/telemetry_actions.jsx'; import {trackEvent} from 'actions/telemetry_actions.jsx';
import {StripeSetupIntent, BillingDetails} from 'types/cloud/sku'; import {getConfirmCardSetup} from 'components/payment_form/stripe';
import {CloudTypes} from 'mattermost-redux/action_types';
import {getBlankAddressWithCountry} from 'utils/utils'; import {getBlankAddressWithCountry} from 'utils/utils';
import {Address, Feedback, WorkspaceDeletionRequest} from '@mattermost/types/cloud';
import type {StripeSetupIntent, BillingDetails} from 'types/cloud/sku';
// Returns true for success, and false for any error // Returns true for success, and false for any error
export function completeStripeAddPaymentMethod( export function completeStripeAddPaymentMethod(

View File

@ -2,23 +2,20 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {Permissions} from 'mattermost-redux/constants';
import {AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import * as Channels from 'mattermost-redux/selectors/entities/channels'; import * as Channels from 'mattermost-redux/selectors/entities/channels';
import * as Teams from 'mattermost-redux/selectors/entities/teams'; import * as Teams from 'mattermost-redux/selectors/entities/teams';
import {Permissions} from 'mattermost-redux/constants';
import {AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import * as GlobalActions from 'actions/global_actions'; import * as GlobalActions from 'actions/global_actions';
import mockStore from 'tests/test_store'; import UserSettingsModal from 'components/user_settings/modal';
import mockStore from 'tests/test_store';
import {ActionTypes, Constants, ModalIdentifiers} from 'utils/constants'; import {ActionTypes, Constants, ModalIdentifiers} from 'utils/constants';
import * as UserAgent from 'utils/user_agent'; import * as UserAgent from 'utils/user_agent';
import * as Utils from 'utils/utils'; import * as Utils from 'utils/utils';
import UserSettingsModal from 'components/user_settings/modal';
import {executeCommand} from './command'; import {executeCommand} from './command';
const currentChannelId = '123'; const currentChannelId = '123';

View File

@ -1,43 +1,41 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Client4} from 'mattermost-redux/client';
import {unfavoriteChannel} from 'mattermost-redux/actions/channels';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {getCurrentChannel, getRedirectChannelNameForTeam, isFavoriteChannel} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getCurrentRelativeTeamUrl, getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {IntegrationTypes} from 'mattermost-redux/action_types';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import type {CommandArgs} from '@mattermost/types/integrations'; import type {CommandArgs} from '@mattermost/types/integrations';
import {IntegrationTypes} from 'mattermost-redux/action_types';
import {unfavoriteChannel} from 'mattermost-redux/actions/channels';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {Client4} from 'mattermost-redux/client';
import {Permissions} from 'mattermost-redux/constants';
import {AppCallResponseTypes} from 'mattermost-redux/constants/apps'; import {AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {getCurrentChannel, getRedirectChannelNameForTeam, isFavoriteChannel} from 'mattermost-redux/selectors/entities/channels';
import {isMarketplaceEnabled} from 'mattermost-redux/selectors/entities/general';
import {haveICurrentTeamPermission} from 'mattermost-redux/selectors/entities/roles';
import {getCurrentRelativeTeamUrl, getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {DoAppCallResult} from 'types/apps';
import {openModal} from 'actions/views/modals';
import * as GlobalActions from 'actions/global_actions'; import * as GlobalActions from 'actions/global_actions';
import * as PostActions from 'actions/post_actions'; import * as PostActions from 'actions/post_actions';
import {openModal} from 'actions/views/modals';
import {isUrlSafe, getSiteURL} from 'utils/url'; import KeyboardShortcutsModal from 'components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal';
import {localizeMessage, getUserIdFromChannelName} from 'utils/utils'; import LeaveChannelModal from 'components/leave_channel_modal';
import * as UserAgent from 'utils/user_agent'; import MarketplaceModal from 'components/plugin_marketplace/marketplace_modal';
import {Constants, ModalIdentifiers} from 'utils/constants';
import {getHistory} from 'utils/browser_history';
import UserSettingsModal from 'components/user_settings/modal';
import {AppCommandParser} from 'components/suggestion/command_provider/app_command_parser/app_command_parser'; import {AppCommandParser} from 'components/suggestion/command_provider/app_command_parser/app_command_parser';
import {intlShim} from 'components/suggestion/command_provider/app_command_parser/app_command_parser_dependencies'; import {intlShim} from 'components/suggestion/command_provider/app_command_parser/app_command_parser_dependencies';
import LeaveChannelModal from 'components/leave_channel_modal'; import UserSettingsModal from 'components/user_settings/modal';
import KeyboardShortcutsModal from 'components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal';
import {GlobalState} from 'types/store'; import {getHistory} from 'utils/browser_history';
import {Constants, ModalIdentifiers} from 'utils/constants';
import {isUrlSafe, getSiteURL} from 'utils/url';
import * as UserAgent from 'utils/user_agent';
import {localizeMessage, getUserIdFromChannelName} from 'utils/utils';
import MarketplaceModal from 'components/plugin_marketplace/marketplace_modal'; import type {DoAppCallResult} from 'types/apps';
import {haveICurrentTeamPermission} from 'mattermost-redux/selectors/entities/roles'; import type {GlobalState} from 'types/store';
import {Permissions} from 'mattermost-redux/constants';
import {isMarketplaceEnabled} from 'mattermost-redux/selectors/entities/general';
import {doAppSubmit, openAppsModal, postEphemeralCallResponseForCommandArgs} from './apps'; import {doAppSubmit, openAppsModal, postEphemeralCallResponseForCommandArgs} from './apps';
import {trackEvent} from './telemetry_actions'; import {trackEvent} from './telemetry_actions';

View File

@ -2,14 +2,13 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import * as EmojiActions from 'mattermost-redux/actions/emojis'; import * as EmojiActions from 'mattermost-redux/actions/emojis';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis'; import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
import {getConfig} from 'mattermost-redux/selectors/entities/general'; import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getEmojiMap, getRecentEmojisData, getRecentEmojisNames, isCustomEmojiEnabled} from 'selectors/emojis'; import {getEmojiMap, getRecentEmojisData, getRecentEmojisNames, isCustomEmojiEnabled} from 'selectors/emojis';
import {isCustomStatusEnabled, makeGetCustomStatus} from 'selectors/views/custom_status'; import {isCustomStatusEnabled, makeGetCustomStatus} from 'selectors/views/custom_status';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import LocalStorageStore from 'stores/local_storage_store'; import LocalStorageStore from 'stores/local_storage_store';
import Constants, {ActionTypes, Preferences} from 'utils/constants'; import Constants, {ActionTypes, Preferences} from 'utils/constants';

View File

@ -1,10 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {getRecentEmojisData, getEmojiMap} from 'selectors/emojis';
import * as EmojiActions from 'actions/emoji_actions';
import * as PreferenceActions from 'mattermost-redux/actions/preferences'; import * as PreferenceActions from 'mattermost-redux/actions/preferences';
import * as EmojiActions from 'actions/emoji_actions';
import {getRecentEmojisData, getEmojiMap} from 'selectors/emojis';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
const currentUserId = 'current_user_id'; const currentUserId = 'current_user_id';

View File

@ -3,15 +3,16 @@
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {FileInfo} from '@mattermost/types/files'; import type {ServerError} from '@mattermost/types/errors';
import {ServerError} from '@mattermost/types/errors'; import type {FileInfo} from '@mattermost/types/files';
import {FileTypes} from 'mattermost-redux/action_types'; import {FileTypes} from 'mattermost-redux/action_types';
import {getLogErrorAction} from 'mattermost-redux/actions/errors'; import {getLogErrorAction} from 'mattermost-redux/actions/errors';
import {forceLogoutIfNecessary} from 'mattermost-redux/actions/helpers'; import {forceLogoutIfNecessary} from 'mattermost-redux/actions/helpers';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {FilePreviewInfo} from 'components/file_preview/file_preview'; import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import type {FilePreviewInfo} from 'components/file_preview/file_preview';
import {localizeMessage} from 'utils/utils'; import {localizeMessage} from 'utils/utils';
@ -92,8 +93,7 @@ export function uploadFile({file, name, type, rootId, channelId, clientId, onPro
try { try {
const errorResponse = JSON.parse(xhr.response); const errorResponse = JSON.parse(xhr.response);
errorMessage = errorMessage =
(errorResponse?.id && errorResponse?.message) ? localizeMessage(errorResponse.id, errorResponse.message) : (errorResponse?.id && errorResponse?.message) ? localizeMessage(errorResponse.id, errorResponse.message) : localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.');
localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.');
} catch (e) { } catch (e) {
errorMessage = localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.'); errorMessage = localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.');
} }
@ -128,9 +128,7 @@ export function uploadFile({file, name, type, rootId, channelId, clientId, onPro
dispatch(batchActions([uploadFailureAction, getLogErrorAction(errorResponse)])); dispatch(batchActions([uploadFailureAction, getLogErrorAction(errorResponse)]));
onError(errorResponse, clientId, channelId, rootId); onError(errorResponse, clientId, channelId, rootId);
} else { } else {
const errorMessage = xhr.status === 0 || !xhr.status ? const errorMessage = xhr.status === 0 || !xhr.status ? localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.') : localizeMessage('channel_loader.unknown_error', 'We received an unexpected status code from the server.') + ' (' + xhr.status + ')';
localizeMessage('file_upload.generic_error', 'There was a problem uploading your files.') :
localizeMessage('channel_loader.unknown_error', 'We received an unexpected status code from the server.') + ' (' + xhr.status + ')';
dispatch({ dispatch({
type: FileTypes.UPLOAD_FILES_FAILURE, type: FileTypes.UPLOAD_FILES_FAILURE,

View File

@ -1,17 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {UserProfile} from '@mattermost/types/users'; import type {Team} from '@mattermost/types/teams';
import {Team} from '@mattermost/types/teams'; import type {UserProfile} from '@mattermost/types/users';
import {getHistory} from 'utils/browser_history'; import {redirectUserToDefaultTeam, toggleSideBarRightMenuAction, getTeamRedirectChannelIfIsAccesible} from 'actions/global_actions';
import {closeRightHandSide, closeMenu as closeRhsMenu} from 'actions/views/rhs';
import {close as closeLhs} from 'actions/views/lhs'; import {close as closeLhs} from 'actions/views/lhs';
import {closeRightHandSide, closeMenu as closeRhsMenu} from 'actions/views/rhs';
import LocalStorageStore from 'stores/local_storage_store'; import LocalStorageStore from 'stores/local_storage_store';
import reduxStore from 'stores/redux_store'; import reduxStore from 'stores/redux_store';
import {redirectUserToDefaultTeam, toggleSideBarRightMenuAction, getTeamRedirectChannelIfIsAccesible} from 'actions/global_actions';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {getHistory} from 'utils/browser_history';
jest.mock('actions/views/rhs', () => ({ jest.mock('actions/views/rhs', () => ({
closeMenu: jest.fn(), closeMenu: jest.fn(),

View File

@ -3,6 +3,13 @@
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import type {Channel, ChannelMembership} from '@mattermost/types/channels';
import type {Post} from '@mattermost/types/posts';
import type {Team} from '@mattermost/types/teams';
import type {UserProfile} from '@mattermost/types/users';
import {ChannelTypes} from 'mattermost-redux/action_types';
import {fetchAppBindings} from 'mattermost-redux/actions/apps';
import { import {
fetchMyChannelsAndMembersREST, fetchMyChannelsAndMembersREST,
getChannelByNameAndTeamName, getChannelByNameAndTeamName,
@ -11,42 +18,37 @@ import {
} from 'mattermost-redux/actions/channels'; } from 'mattermost-redux/actions/channels';
import {logout, loadMe, loadMeREST} from 'mattermost-redux/actions/users'; import {logout, loadMe, loadMeREST} from 'mattermost-redux/actions/users';
import {Preferences} from 'mattermost-redux/constants'; import {Preferences} from 'mattermost-redux/constants';
import {getConfig, isPerformanceDebuggingEnabled} from 'mattermost-redux/selectors/entities/general';
import {getCurrentTeamId, getMyTeams, getTeam, getMyTeamMember, getTeamMemberships, getActiveTeamsList} from 'mattermost-redux/selectors/entities/teams';
import {getBool, getIsOnboardingFlowEnabled, isCollapsedThreadsEnabled, isGraphQLEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUser, getCurrentUserId, isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
import {getCurrentChannelStats, getCurrentChannelId, getMyChannelMember, getRedirectChannelNameForTeam, getChannelsNameMapInTeam, getAllDirectChannels, getChannelMessageCount} from 'mattermost-redux/selectors/entities/channels';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps'; import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {ChannelTypes} from 'mattermost-redux/action_types'; import {getCurrentChannelStats, getCurrentChannelId, getMyChannelMember, getRedirectChannelNameForTeam, getChannelsNameMapInTeam, getAllDirectChannels, getChannelMessageCount} from 'mattermost-redux/selectors/entities/channels';
import {fetchAppBindings} from 'mattermost-redux/actions/apps'; import {getConfig, isPerformanceDebuggingEnabled} from 'mattermost-redux/selectors/entities/general';
import {Channel, ChannelMembership} from '@mattermost/types/channels'; import {getBool, getIsOnboardingFlowEnabled, isCollapsedThreadsEnabled, isGraphQLEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {UserProfile} from '@mattermost/types/users'; import {getCurrentTeamId, getMyTeams, getTeam, getMyTeamMember, getTeamMemberships, getActiveTeamsList} from 'mattermost-redux/selectors/entities/teams';
import {Post} from '@mattermost/types/posts'; import {getCurrentUser, getCurrentUserId, isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {Team} from '@mattermost/types/teams';
import {calculateUnreadCount} from 'mattermost-redux/utils/channel_utils'; import {calculateUnreadCount} from 'mattermost-redux/utils/channel_utils';
import {getHistory} from 'utils/browser_history';
import {handleNewPost} from 'actions/post_actions'; import {handleNewPost} from 'actions/post_actions';
import {stopPeriodicStatusUpdates} from 'actions/status_actions'; import {stopPeriodicStatusUpdates} from 'actions/status_actions';
import {loadProfilesForSidebar} from 'actions/user_actions'; import {loadProfilesForSidebar} from 'actions/user_actions';
import {closeRightHandSide, closeMenu as closeRhsMenu, updateRhsState} from 'actions/views/rhs';
import {clearUserCookie} from 'actions/views/cookie'; import {clearUserCookie} from 'actions/views/cookie';
import {close as closeLhs} from 'actions/views/lhs'; import {close as closeLhs} from 'actions/views/lhs';
import {closeRightHandSide, closeMenu as closeRhsMenu, updateRhsState} from 'actions/views/rhs';
import * as WebsocketActions from 'actions/websocket_actions.jsx'; import * as WebsocketActions from 'actions/websocket_actions.jsx';
import {getCurrentLocale} from 'selectors/i18n'; import {getCurrentLocale} from 'selectors/i18n';
import {getIsRhsOpen, getPreviousRhsState, getRhsState} from 'selectors/rhs'; import {getIsRhsOpen, getPreviousRhsState, getRhsState} from 'selectors/rhs';
import BrowserStore from 'stores/browser_store'; import BrowserStore from 'stores/browser_store';
import store from 'stores/redux_store.jsx';
import LocalStorageStore from 'stores/local_storage_store'; import LocalStorageStore from 'stores/local_storage_store';
import store from 'stores/redux_store.jsx';
import SubMenuModal from 'components/widgets/menu/menu_modals/submenu_modal/submenu_modal';
import WebSocketClient from 'client/web_websocket_client.jsx'; import WebSocketClient from 'client/web_websocket_client.jsx';
import {getHistory} from 'utils/browser_history';
import {GlobalState} from 'types/store';
import {ActionTypes, PostTypes, RHSStates, ModalIdentifiers, PreviousViewedTypes} from 'utils/constants'; import {ActionTypes, PostTypes, RHSStates, ModalIdentifiers, PreviousViewedTypes} from 'utils/constants';
import {filterAndSortTeamsByDisplayName} from 'utils/team_utils'; import {filterAndSortTeamsByDisplayName} from 'utils/team_utils';
import * as Utils from 'utils/utils'; import * as Utils from 'utils/utils';
import SubMenuModal from '../components/widgets/menu/menu_modals/submenu_modal/submenu_modal';
import type {GlobalState} from 'types/store';
import {openModal} from './views/modals'; import {openModal} from './views/modals';

View File

@ -2,6 +2,7 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {General} from 'mattermost-redux/constants'; import {General} from 'mattermost-redux/constants';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import { import {

View File

@ -1,22 +1,23 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Stripe} from '@stripe/stripe-js'; import type {Stripe} from '@stripe/stripe-js';
import {getCode} from 'country-list'; import {getCode} from 'country-list';
import {CreateSubscriptionRequest} from '@mattermost/types/cloud'; import type {CreateSubscriptionRequest} from '@mattermost/types/cloud';
import {SelfHostedExpansionRequest, SelfHostedSignupProgress} from '@mattermost/types/hosted_customer'; import type {SelfHostedExpansionRequest} from '@mattermost/types/hosted_customer';
import {ValueOf} from '@mattermost/types/utilities'; import {SelfHostedSignupProgress} from '@mattermost/types/hosted_customer';
import type {ValueOf} from '@mattermost/types/utilities';
import {Client4} from 'mattermost-redux/client';
import {HostedCustomerTypes} from 'mattermost-redux/action_types'; import {HostedCustomerTypes} from 'mattermost-redux/action_types';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import {bindClientFunc} from 'mattermost-redux/actions/helpers';
import {Client4} from 'mattermost-redux/client';
import {getSelfHostedErrors} from 'mattermost-redux/selectors/entities/hosted_customer'; import {getSelfHostedErrors} from 'mattermost-redux/selectors/entities/hosted_customer';
import {StripeSetupIntent, BillingDetails} from 'types/cloud/sku'; import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getConfirmCardSetup} from 'components/payment_form/stripe'; import {getConfirmCardSetup} from 'components/payment_form/stripe';
import {bindClientFunc} from 'mattermost-redux/actions/helpers';
import type {StripeSetupIntent, BillingDetails} from 'types/cloud/sku';
function selfHostedNeedsConfirmation(progress: ValueOf<typeof SelfHostedSignupProgress>): boolean { function selfHostedNeedsConfirmation(progress: ValueOf<typeof SelfHostedSignupProgress>): boolean {
switch (progress) { switch (progress) {

View File

@ -3,8 +3,8 @@
import * as IntegrationActions from 'mattermost-redux/actions/integrations'; import * as IntegrationActions from 'mattermost-redux/actions/integrations';
import {getProfilesByIds} from 'mattermost-redux/actions/users'; import {getProfilesByIds} from 'mattermost-redux/actions/users';
import {getUser} from 'mattermost-redux/selectors/entities/users';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps'; import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {getUser} from 'mattermost-redux/selectors/entities/users';
const DEFAULT_PAGE_SIZE = 100; const DEFAULT_PAGE_SIZE = 100;

View File

@ -3,10 +3,10 @@
import {getProfilesByIds} from 'mattermost-redux/actions/users'; import {getProfilesByIds} from 'mattermost-redux/actions/users';
import mockStore from 'tests/test_store';
import * as Actions from 'actions/integration_actions.jsx'; import * as Actions from 'actions/integration_actions.jsx';
import mockStore from 'tests/test_store';
jest.mock('mattermost-redux/actions/users', () => ({ jest.mock('mattermost-redux/actions/users', () => ({
getProfilesByIds: jest.fn(() => { getProfilesByIds: jest.fn(() => {
return {type: ''}; return {type: ''};

View File

@ -1,14 +1,15 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Channel} from '@mattermost/types/channels'; import type {Channel} from '@mattermost/types/channels';
import {UserProfile} from '@mattermost/types/users'; import type {UserProfile} from '@mattermost/types/users';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {sendMembersInvites, sendGuestsInvites} from 'actions/invite_actions'; import {sendMembersInvites, sendGuestsInvites} from 'actions/invite_actions';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {ConsolePages} from '../utils/constants'; import {ConsolePages} from 'utils/constants';
jest.mock('actions/team_actions', () => ({ jest.mock('actions/team_actions', () => ({
addUsersToTeam: () => ({ // since we are using addUsersToTeamGracefully, this call will always succeed addUsersToTeam: () => ({ // since we are using addUsersToTeamGracefully, this call will always succeed

View File

@ -1,23 +1,24 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {RelationOneToOne} from '@mattermost/types/utilities'; import type {Channel, ChannelMembership} from '@mattermost/types/channels';
import {UserProfile} from '@mattermost/types/users'; import type {TeamMemberWithError, TeamInviteWithError} from '@mattermost/types/teams';
import {Channel, ChannelMembership} from '@mattermost/types/channels'; import type {UserProfile} from '@mattermost/types/users';
import {TeamMemberWithError, TeamInviteWithError} from '@mattermost/types/teams'; import type {RelationOneToOne} from '@mattermost/types/utilities';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import * as TeamActions from 'mattermost-redux/actions/teams';
import {joinChannel} from 'mattermost-redux/actions/channels'; import {joinChannel} from 'mattermost-redux/actions/channels';
import {getTeamMember} from 'mattermost-redux/selectors/entities/teams'; import * as TeamActions from 'mattermost-redux/actions/teams';
import {getChannelMembersInChannels} from 'mattermost-redux/selectors/entities/channels'; import {getChannelMembersInChannels} from 'mattermost-redux/selectors/entities/channels';
import {getTeamMember} from 'mattermost-redux/selectors/entities/teams';
import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users'; import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {isGuest} from 'mattermost-redux/utils/user_utils'; import {isGuest} from 'mattermost-redux/utils/user_utils';
import {addUsersToTeam} from 'actions/team_actions'; import {addUsersToTeam} from 'actions/team_actions';
import {ConsolePages} from 'utils/constants';
import {t} from 'utils/i18n'; import {t} from 'utils/i18n';
import {localizeMessage} from 'utils/utils'; import {localizeMessage} from 'utils/utils';
import {ConsolePages} from 'utils/constants';
export function sendMembersInvites(teamId: string, users: UserProfile[], emails: string[]): ActionFunc { export function sendMembersInvites(teamId: string, users: UserProfile[], emails: string[]): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => { return async (dispatch: DispatchFunc, getState: GetStateFunc) => {

View File

@ -1,24 +1,25 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Client4} from 'mattermost-redux/client'; import type {AppCall, AppExpand, AppFormValues} from '@mattermost/types/apps';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import type {MarketplaceApp, MarketplacePlugin} from '@mattermost/types/marketplace'; import type {MarketplaceApp, MarketplacePlugin} from '@mattermost/types/marketplace';
import {GlobalState} from 'types/store'; import {Client4} from 'mattermost-redux/client';
import {AppBindingLocations, AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getFilter, getPlugin} from 'selectors/views/marketplace'; import {getFilter, getPlugin} from 'selectors/views/marketplace';
import {intlShim} from 'components/suggestion/command_provider/app_command_parser/app_command_parser_dependencies';
import type {DoAppCallResult} from 'components/suggestion/command_provider/app_command_parser/app_command_parser_dependencies';
import {createCallContext, createCallRequest} from 'utils/apps';
import {ActionTypes} from 'utils/constants'; import {ActionTypes} from 'utils/constants';
import {AppBindingLocations, AppCallResponseTypes} from 'mattermost-redux/constants/apps'; import type {GlobalState} from 'types/store';
import {AppCall, AppExpand, AppFormValues} from '@mattermost/types/apps';
import {createCallContext, createCallRequest} from 'utils/apps';
import {DoAppCallResult, intlShim} from 'components/suggestion/command_provider/app_command_parser/app_command_parser_dependencies';
import {doAppSubmit, openAppsModal, postEphemeralCallResponseForContext} from './apps'; import {doAppSubmit, openAppsModal, postEphemeralCallResponseForContext} from './apps';

View File

@ -1,21 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
// import thunk from 'redux-thunk'; import type {Post} from '@mattermost/types/posts';
// import configureStore from 'redux-mock-store'; import type {GlobalState} from '@mattermost/types/store';
import {Post} from '@mattermost/types/posts';
import {ChannelTypes} from 'mattermost-redux/action_types'; import {ChannelTypes} from 'mattermost-redux/action_types';
import {receivedNewPost} from 'mattermost-redux/actions/posts'; import {receivedNewPost} from 'mattermost-redux/actions/posts';
import {Posts} from 'mattermost-redux/constants'; import {Posts} from 'mattermost-redux/constants';
import type {GetStateFunc} from 'mattermost-redux/types/actions';
import * as NewPostActions from 'actions/new_post'; import * as NewPostActions from 'actions/new_post';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {Constants} from 'utils/constants'; import {Constants} from 'utils/constants';
import {GlobalState} from '@mattermost/types/store';
import {GetStateFunc} from 'mattermost-redux/types/actions';
jest.mock('mattermost-redux/actions/channels', () => ({ jest.mock('mattermost-redux/actions/channels', () => ({
...jest.requireActual('mattermost-redux/actions/channels'), ...jest.requireActual('mattermost-redux/actions/channels'),

View File

@ -1,10 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import * as Redux from 'redux'; import type * as Redux from 'redux';
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences'; import type {Post} from '@mattermost/types/posts';
import { import {
actionsToMarkChannelAsRead, actionsToMarkChannelAsRead,
@ -12,28 +12,25 @@ import {
markChannelAsViewedOnServer, markChannelAsViewedOnServer,
} from 'mattermost-redux/actions/channels'; } from 'mattermost-redux/actions/channels';
import * as PostActions from 'mattermost-redux/actions/posts'; import * as PostActions from 'mattermost-redux/actions/posts';
import {getCurrentChannelId, isManuallyUnread} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannelId, isManuallyUnread} from 'mattermost-redux/selectors/entities/channels';
import * as PostSelectors from 'mattermost-redux/selectors/entities/posts'; import * as PostSelectors from 'mattermost-redux/selectors/entities/posts';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getThread} from 'mattermost-redux/selectors/entities/threads'; import {getThread} from 'mattermost-redux/selectors/entities/threads';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {Post} from '@mattermost/types/posts';
import { import {
isFromWebhook, isFromWebhook,
isSystemMessage, isSystemMessage,
shouldIgnorePost, shouldIgnorePost,
} from 'mattermost-redux/utils/post_utils'; } from 'mattermost-redux/utils/post_utils';
import {GlobalState} from 'types/store';
import {updateThreadLastOpened} from 'actions/views/threads';
import {sendDesktopNotification} from 'actions/notification_actions.jsx'; import {sendDesktopNotification} from 'actions/notification_actions.jsx';
import {updateThreadLastOpened} from 'actions/views/threads';
import {isThreadOpen, makeGetThreadLastViewedAt} from 'selectors/views/threads';
import {ActionTypes} from 'utils/constants'; import {ActionTypes} from 'utils/constants';
import {isThreadOpen, makeGetThreadLastViewedAt} from 'selectors/views/threads';
import type {GlobalState} from 'types/store';
export type NewPostMessageProps = { export type NewPostMessageProps = {
mentions: string[]; mentions: string[];

View File

@ -14,17 +14,18 @@ import {isChannelMuted} from 'mattermost-redux/utils/channel_utils';
import {isSystemMessage, isUserAddedInChannel} from 'mattermost-redux/utils/post_utils'; import {isSystemMessage, isUserAddedInChannel} from 'mattermost-redux/utils/post_utils';
import {displayUsername} from 'mattermost-redux/utils/user_utils'; import {displayUsername} from 'mattermost-redux/utils/user_utils';
import {isThreadOpen} from 'selectors/views/threads';
import {getChannelURL, getPermalinkURL} from 'selectors/urls'; import {getChannelURL, getPermalinkURL} from 'selectors/urls';
import {isThreadOpen} from 'selectors/views/threads';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import Constants, {NotificationLevels, UserStatuses} from 'utils/constants'; import Constants, {NotificationLevels, UserStatuses} from 'utils/constants';
import {t} from 'utils/i18n';
import {stripMarkdown} from 'utils/markdown';
import * as NotificationSounds from 'utils/notification_sounds'; import * as NotificationSounds from 'utils/notification_sounds';
import {showNotification} from 'utils/notifications'; import {showNotification} from 'utils/notifications';
import {isDesktopApp, isMobileApp, isWindowsApp} from 'utils/user_agent'; import {isDesktopApp, isMobileApp, isWindowsApp} from 'utils/user_agent';
import * as Utils from 'utils/utils'; import * as Utils from 'utils/utils';
import {t} from 'utils/i18n';
import {stripMarkdown} from 'utils/markdown';
import {runDesktopNotificationHooks} from './hooks'; import {runDesktopNotificationHooks} from './hooks';
const NOTIFY_TEXT_MAX_LENGTH = 50; const NOTIFY_TEXT_MAX_LENGTH = 50;

View File

@ -2,7 +2,6 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import testConfigureStore from 'tests/test_store'; import testConfigureStore from 'tests/test_store';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import Constants, {NotificationLevels, UserStatuses} from 'utils/constants'; import Constants, {NotificationLevels, UserStatuses} from 'utils/constants';
import * as NotificationSounds from 'utils/notification_sounds'; import * as NotificationSounds from 'utils/notification_sounds';

View File

@ -1,18 +1,19 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Post} from '@mattermost/types/posts'; import type {FileInfo} from '@mattermost/types/files';
import {FileInfo} from '@mattermost/types/files'; import type {Post} from '@mattermost/types/posts';
import {GlobalState} from 'types/store';
import {ChannelTypes, SearchTypes} from 'mattermost-redux/action_types'; import {ChannelTypes, SearchTypes} from 'mattermost-redux/action_types';
import * as PostActions from 'mattermost-redux/actions/posts'; import * as PostActions from 'mattermost-redux/actions/posts';
import {Posts} from 'mattermost-redux/constants'; import {Posts} from 'mattermost-redux/constants';
import * as Actions from 'actions/post_actions'; import * as Actions from 'actions/post_actions';
import {Constants, ActionTypes, RHSStates} from 'utils/constants';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {Constants, ActionTypes, RHSStates} from 'utils/constants';
import type {GlobalState} from 'types/store';
jest.mock('mattermost-redux/actions/posts', () => ({ jest.mock('mattermost-redux/actions/posts', () => ({
addReaction: (...args: any[]) => ({type: 'MOCK_ADD_REACTION', args}), addReaction: (...args: any[]) => ({type: 'MOCK_ADD_REACTION', args}),

View File

@ -1,32 +1,32 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Post} from '@mattermost/types/posts'; import type {FileInfo} from '@mattermost/types/files';
import {GroupChannel} from '@mattermost/types/groups'; import type {GroupChannel} from '@mattermost/types/groups';
import {FileInfo} from '@mattermost/types/files'; import type {Post} from '@mattermost/types/posts';
import {SearchTypes} from 'mattermost-redux/action_types'; import {SearchTypes} from 'mattermost-redux/action_types';
import {getMyChannelMember} from 'mattermost-redux/actions/channels'; import {getMyChannelMember} from 'mattermost-redux/actions/channels';
import {getChannel, getMyChannelMember as getMyChannelMemberSelector} from 'mattermost-redux/selectors/entities/channels';
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import * as ThreadActions from 'mattermost-redux/actions/threads';
import * as PostActions from 'mattermost-redux/actions/posts'; import * as PostActions from 'mattermost-redux/actions/posts';
import * as ThreadActions from 'mattermost-redux/actions/threads';
import {getChannel, getMyChannelMember as getMyChannelMemberSelector} from 'mattermost-redux/selectors/entities/channels';
import * as PostSelectors from 'mattermost-redux/selectors/entities/posts'; import * as PostSelectors from 'mattermost-redux/selectors/entities/posts';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {canEditPost, comparePosts} from 'mattermost-redux/utils/post_utils'; import {canEditPost, comparePosts} from 'mattermost-redux/utils/post_utils';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {addRecentEmoji, addRecentEmojis} from 'actions/emoji_actions'; import {addRecentEmoji, addRecentEmojis} from 'actions/emoji_actions';
import * as StorageActions from 'actions/storage'; import * as StorageActions from 'actions/storage';
import {loadNewDMIfNeeded, loadNewGMIfNeeded} from 'actions/user_actions'; import {loadNewDMIfNeeded, loadNewGMIfNeeded} from 'actions/user_actions';
import {removeDraft} from 'actions/views/drafts';
import * as RhsActions from 'actions/views/rhs'; import * as RhsActions from 'actions/views/rhs';
import {manuallyMarkThreadAsUnread} from 'actions/views/threads'; import {manuallyMarkThreadAsUnread} from 'actions/views/threads';
import {removeDraft} from 'actions/views/drafts';
import {isEmbedVisible, isInlineImageVisible} from 'selectors/posts'; import {isEmbedVisible, isInlineImageVisible} from 'selectors/posts';
import {getSelectedPostId, getSelectedPostCardId, getRhsState} from 'selectors/rhs'; import {getSelectedPostId, getSelectedPostCardId, getRhsState} from 'selectors/rhs';
import {getGlobalItem} from 'selectors/storage'; import {getGlobalItem} from 'selectors/storage';
import {GlobalState} from 'types/store';
import { import {
ActionTypes, ActionTypes,
Constants, Constants,
@ -36,7 +36,10 @@ import {
import {matchEmoticons} from 'utils/emoticons'; import {matchEmoticons} from 'utils/emoticons';
import * as UserAgent from 'utils/user_agent'; import * as UserAgent from 'utils/user_agent';
import {completePostReceive, NewPostMessageProps} from './new_post'; import type {GlobalState} from 'types/store';
import {completePostReceive} from './new_post';
import type {NewPostMessageProps} from './new_post';
export function handleNewPost(post: Post, msg?: {data?: NewPostMessageProps & GroupChannel}) { export function handleNewPost(post: Post, msg?: {data?: NewPostMessageProps & GroupChannel}) {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => { return async (dispatch: DispatchFunc, getState: GetStateFunc) => {

View File

@ -3,16 +3,17 @@
import {cloneDeep} from 'lodash'; import {cloneDeep} from 'lodash';
import {UserProfile} from '@mattermost/types/users'; import type {UserProfile} from '@mattermost/types/users';
import {Preferences} from 'mattermost-redux/constants';
import {getStatusesByIds} from 'mattermost-redux/actions/users'; import {getStatusesByIds} from 'mattermost-redux/actions/users';
import {Preferences} from 'mattermost-redux/constants';
import * as Actions from 'actions/status_actions'; import * as Actions from 'actions/status_actions';
import {GlobalState} from 'types/store';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import type {GlobalState} from 'types/store';
jest.mock('mattermost-redux/actions/users', () => ({ jest.mock('mattermost-redux/actions/users', () => ({
getStatusesByIds: jest.fn(() => { getStatusesByIds: jest.fn(() => {
return {type: ''}; return {type: ''};

View File

@ -1,19 +1,21 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {UserProfile} from '@mattermost/types/users'; import type {UserProfile} from '@mattermost/types/users';
import {getStatusesByIds} from 'mattermost-redux/actions/users'; import {getStatusesByIds} from 'mattermost-redux/actions/users';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getPostsInCurrentChannel} from 'mattermost-redux/selectors/entities/posts'; import {getPostsInCurrentChannel} from 'mattermost-redux/selectors/entities/posts';
import {getDirectShowPreferences} from 'mattermost-redux/selectors/entities/preferences'; import {getDirectShowPreferences} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {GlobalState} from 'types/store';
import {loadCustomEmojisForCustomStatusesByUserIds} from 'actions/emoji_actions'; import {loadCustomEmojisForCustomStatusesByUserIds} from 'actions/emoji_actions';
import {Constants} from 'utils/constants'; import {Constants} from 'utils/constants';
import type {GlobalState} from 'types/store';
export function loadStatusesForChannelAndSidebar(): ActionFunc { export function loadStatusesForChannelAndSidebar(): ActionFunc {
return (dispatch: DispatchFunc, getState: GetStateFunc) => { return (dispatch: DispatchFunc, getState: GetStateFunc) => {
const state = getState(); const state = getState();

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {StorageTypes} from 'utils/constants'; import {StorageTypes} from 'utils/constants';
import {getPrefix} from 'utils/storage_utils'; import {getPrefix} from 'utils/storage_utils';

View File

@ -1,14 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import * as TeamActions from 'mattermost-redux/actions/teams';
import * as channelActions from 'mattermost-redux/actions/channels'; import * as channelActions from 'mattermost-redux/actions/channels';
import * as TeamActions from 'mattermost-redux/actions/teams';
import * as userActions from 'mattermost-redux/actions/users'; import * as userActions from 'mattermost-redux/actions/users';
import * as Actions from 'actions/team_actions'; import * as Actions from 'actions/team_actions';
import configureStore from 'tests/test_store'; import configureStore from 'tests/test_store';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';

View File

@ -1,19 +1,19 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Team} from '@mattermost/types/teams'; import type {ServerError} from '@mattermost/types/errors';
import {ServerError} from '@mattermost/types/errors'; import type {Team} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users'; import type {UserProfile} from '@mattermost/types/users';
import {TeamTypes} from 'mattermost-redux/action_types'; import {TeamTypes} from 'mattermost-redux/action_types';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getChannelStats} from 'mattermost-redux/actions/channels'; import {getChannelStats} from 'mattermost-redux/actions/channels';
import * as TeamActions from 'mattermost-redux/actions/teams';
import {getUser} from 'mattermost-redux/actions/users';
import {savePreferences} from 'mattermost-redux/actions/preferences'; import {savePreferences} from 'mattermost-redux/actions/preferences';
import * as TeamActions from 'mattermost-redux/actions/teams';
import {selectTeam} from 'mattermost-redux/actions/teams'; import {selectTeam} from 'mattermost-redux/actions/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {getUser} from 'mattermost-redux/actions/users';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import {Preferences} from 'utils/constants'; import {Preferences} from 'utils/constants';

View File

@ -8,7 +8,6 @@ import {getConfig, isPerformanceDebuggingEnabled} from 'mattermost-redux/selecto
import {getBool} from 'mattermost-redux/selectors/entities/preferences'; import {getBool} from 'mattermost-redux/selectors/entities/preferences';
import {isDevModeEnabled} from 'selectors/general'; import {isDevModeEnabled} from 'selectors/general';
import store from 'stores/redux_store.jsx'; import store from 'stores/redux_store.jsx';
const SUPPORTS_CLEAR_MARKS = isSupported([performance.clearMarks]); const SUPPORTS_CLEAR_MARKS = isSupported([performance.clearMarks]);

View File

@ -1,10 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Channel, ChannelMembership, ChannelMessageCount} from '@mattermost/types/channels'; import type {Channel, ChannelMembership, ChannelMessageCount} from '@mattermost/types/channels';
import {Team, TeamMembership} from '@mattermost/types/teams'; import type {Post} from '@mattermost/types/posts';
import {Post} from '@mattermost/types/posts'; import type {Team, TeamMembership} from '@mattermost/types/teams';
import {UserProfile} from '@mattermost/types/users'; import type {UserProfile} from '@mattermost/types/users';
import {Preferences, General} from 'mattermost-redux/constants'; import {Preferences, General} from 'mattermost-redux/constants';
import {CategoryTypes} from 'mattermost-redux/constants/channel_categories'; import {CategoryTypes} from 'mattermost-redux/constants/channel_categories';
@ -12,12 +12,12 @@ import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils';
import * as UserActions from 'actions/user_actions'; import * as UserActions from 'actions/user_actions';
import store from 'stores/redux_store'; import store from 'stores/redux_store';
import TestHelper from 'packages/mattermost-redux/test/test_helper'; import TestHelper from 'packages/mattermost-redux/test/test_helper';
import {GlobalState} from 'types/store';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import type {GlobalState} from 'types/store';
jest.mock('mattermost-redux/actions/users', () => { jest.mock('mattermost-redux/actions/users', () => {
const original = jest.requireActual('mattermost-redux/actions/users'); const original = jest.requireActual('mattermost-redux/actions/users');
return { return {

View File

@ -3,10 +3,8 @@
import PQueue from 'p-queue'; import PQueue from 'p-queue';
import {UserProfile, UserStatus} from '@mattermost/types/users'; import type {Channel} from '@mattermost/types/channels';
import type {UserProfile, UserStatus} from '@mattermost/types/users';
import {Channel} from '@mattermost/types/channels';
import {GlobalState} from 'types/store';
import {getChannelAndMyMember, getChannelMembersByIds} from 'mattermost-redux/actions/channels'; import {getChannelAndMyMember, getChannelMembersByIds} from 'mattermost-redux/actions/channels';
import {savePreferences} from 'mattermost-redux/actions/preferences'; import {savePreferences} from 'mattermost-redux/actions/preferences';
@ -24,19 +22,18 @@ import {
import {getBool, isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences'; import {getBool, isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentTeamId, getTeamMember} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentTeamId, getTeamMember} from 'mattermost-redux/selectors/entities/teams';
import * as Selectors from 'mattermost-redux/selectors/entities/users'; import * as Selectors from 'mattermost-redux/selectors/entities/users';
import {ActionResult, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {ActionResult, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {calculateUnreadCount} from 'mattermost-redux/utils/channel_utils'; import {calculateUnreadCount} from 'mattermost-redux/utils/channel_utils';
import {loadCustomEmojisForCustomStatusesByUserIds} from 'actions/emoji_actions'; import {loadCustomEmojisForCustomStatusesByUserIds} from 'actions/emoji_actions';
import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions'; import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions';
import {getDisplayedChannels} from 'selectors/views/channel_sidebar'; import {getDisplayedChannels} from 'selectors/views/channel_sidebar';
import store from 'stores/redux_store.jsx'; import store from 'stores/redux_store.jsx';
import * as Utils from 'utils/utils';
import {Constants, Preferences, UserStatuses} from 'utils/constants'; import {Constants, Preferences, UserStatuses} from 'utils/constants';
import * as Utils from 'utils/utils';
import type {GlobalState} from 'types/store';
export const queue = new PQueue({concurrency: 4}); export const queue = new PQueue({concurrency: 4});
const dispatch = store.dispatch; const dispatch = store.dispatch;

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {GenericAction} from 'mattermost-redux/types/actions'; import type {GenericAction} from 'mattermost-redux/types/actions';
import {Constants, ActionTypes, WindowSizes} from 'utils/constants'; import {Constants, ActionTypes, WindowSizes} from 'utils/constants';

View File

@ -1,15 +1,16 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {General, Posts, RequestStatus} from 'mattermost-redux/constants';
import {leaveChannel, markChannelAsRead, getChannel} from 'mattermost-redux/actions/channels'; import {leaveChannel, markChannelAsRead, getChannel} from 'mattermost-redux/actions/channels';
import * as UserActions from 'mattermost-redux/actions/users';
import * as PostActions from 'mattermost-redux/actions/posts'; import * as PostActions from 'mattermost-redux/actions/posts';
import * as UserActions from 'mattermost-redux/actions/users';
import {General, Posts, RequestStatus} from 'mattermost-redux/constants';
import {getHistory} from 'utils/browser_history';
import * as Actions from 'actions/views/channel'; import * as Actions from 'actions/views/channel';
import {closeRightHandSide} from 'actions/views/rhs'; import {closeRightHandSide} from 'actions/views/rhs';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {getHistory} from 'utils/browser_history';
import {ActionTypes, PostRequestTypes} from 'utils/constants'; import {ActionTypes, PostRequestTypes} from 'utils/constants';
jest.mock('utils/channel_utils.tsx', () => { jest.mock('utils/channel_utils.tsx', () => {

View File

@ -1,11 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import type {AnyAction} from 'redux';
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {AnyAction} from 'redux';
import {Channel} from '@mattermost/types/channels'; import type {Channel} from '@mattermost/types/channels';
import {TeamTypes} from 'mattermost-redux/action_types';
import { import {
leaveChannel as leaveChannelRedux, leaveChannel as leaveChannelRedux,
joinChannel, joinChannel,
@ -15,12 +16,9 @@ import {
getChannel as loadChannel, getChannel as loadChannel,
} from 'mattermost-redux/actions/channels'; } from 'mattermost-redux/actions/channels';
import * as PostActions from 'mattermost-redux/actions/posts'; import * as PostActions from 'mattermost-redux/actions/posts';
import {TeamTypes} from 'mattermost-redux/action_types';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {autocompleteUsers} from 'mattermost-redux/actions/users';
import {selectTeam} from 'mattermost-redux/actions/teams'; import {selectTeam} from 'mattermost-redux/actions/teams';
import {autocompleteUsers} from 'mattermost-redux/actions/users';
import {Posts, RequestStatus} from 'mattermost-redux/constants'; import {Posts, RequestStatus} from 'mattermost-redux/constants';
import { import {
getChannel, getChannel,
getChannelsNameMapInCurrentTeam, getChannelsNameMapInCurrentTeam,
@ -33,6 +31,7 @@ import {
isManuallyUnread, isManuallyUnread,
getCurrentChannelId, getCurrentChannelId,
} from 'mattermost-redux/selectors/entities/channels'; } from 'mattermost-redux/selectors/entities/channels';
import {getMostRecentPostIdInChannel, getPost} from 'mattermost-redux/selectors/entities/posts';
import { import {
getCurrentRelativeTeamUrl, getCurrentRelativeTeamUrl,
getCurrentTeam, getCurrentTeam,
@ -41,24 +40,24 @@ import {
getTeamsList, getTeamsList,
} from 'mattermost-redux/selectors/entities/teams'; } from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId, getUserByUsername} from 'mattermost-redux/selectors/entities/users'; import {getCurrentUserId, getUserByUsername} from 'mattermost-redux/selectors/entities/users';
import {getMostRecentPostIdInChannel, getPost} from 'mattermost-redux/selectors/entities/posts';
import {makeAddLastViewAtToProfiles} from 'mattermost-redux/selectors/entities/utils'; import {makeAddLastViewAtToProfiles} from 'mattermost-redux/selectors/entities/utils';
import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getChannelByName} from 'mattermost-redux/utils/channel_utils'; import {getChannelByName} from 'mattermost-redux/utils/channel_utils';
import EventEmitter from 'mattermost-redux/utils/event_emitter'; import EventEmitter from 'mattermost-redux/utils/event_emitter';
import {closeRightHandSide} from 'actions/views/rhs';
import {openDirectChannelToUserId} from 'actions/channel_actions'; import {openDirectChannelToUserId} from 'actions/channel_actions';
import {loadCustomStatusEmojisForPostList} from 'actions/emoji_actions'; import {loadCustomStatusEmojisForPostList} from 'actions/emoji_actions';
import {closeRightHandSide} from 'actions/views/rhs';
import {getLastViewedChannelName} from 'selectors/local_storage'; import {getLastViewedChannelName} from 'selectors/local_storage';
import {getSelectedPost, getSelectedPostId} from 'selectors/rhs';
import {getLastPostsApiTimeForChannel} from 'selectors/views/channel'; import {getLastPostsApiTimeForChannel} from 'selectors/views/channel';
import {getSocketStatus} from 'selectors/views/websocket'; import {getSocketStatus} from 'selectors/views/websocket';
import {getSelectedPost, getSelectedPostId} from 'selectors/rhs'; import LocalStorageStore from 'stores/local_storage_store';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import {Constants, ActionTypes, EventTypes, PostRequestTypes} from 'utils/constants';
import LocalStorageStore from 'stores/local_storage_store';
import {isArchivedChannel} from 'utils/channel_utils'; import {isArchivedChannel} from 'utils/channel_utils';
import {Constants, ActionTypes, EventTypes, PostRequestTypes} from 'utils/constants';
import type {GlobalState} from 'types/store'; import type {GlobalState} from 'types/store';
export function goToLastViewedChannel() { export function goToLastViewedChannel() {

View File

@ -2,7 +2,7 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {CategorySorting} from '@mattermost/types/channel_categories'; import {CategorySorting} from '@mattermost/types/channel_categories';
import {Channel, ChannelMembership} from '@mattermost/types/channels'; import type {Channel, ChannelMembership} from '@mattermost/types/channels';
import {insertWithoutDuplicates} from 'mattermost-redux/utils/array_utils'; import {insertWithoutDuplicates} from 'mattermost-redux/utils/array_utils';

View File

@ -6,13 +6,15 @@ import {General} from 'mattermost-redux/constants';
import {CategoryTypes} from 'mattermost-redux/constants/channel_categories'; import {CategoryTypes} from 'mattermost-redux/constants/channel_categories';
import {getCategory, makeGetChannelIdsForCategory} from 'mattermost-redux/selectors/entities/channel_categories'; import {getCategory, makeGetChannelIdsForCategory} from 'mattermost-redux/selectors/entities/channel_categories';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {insertMultipleWithoutDuplicates} from 'mattermost-redux/utils/array_utils'; import {insertMultipleWithoutDuplicates} from 'mattermost-redux/utils/array_utils';
import {getCategoriesForCurrentTeam, getChannelsInCategoryOrder, getDisplayedChannels} from 'selectors/views/channel_sidebar'; import {getCategoriesForCurrentTeam, getChannelsInCategoryOrder, getDisplayedChannels} from 'selectors/views/channel_sidebar';
import {DraggingState, GlobalState} from 'types/store';
import {ActionTypes} from 'utils/constants'; import {ActionTypes} from 'utils/constants';
import type {DraggingState, GlobalState} from 'types/store';
export function setUnreadFilterEnabled(enabled: boolean) { export function setUnreadFilterEnabled(enabled: boolean) {
return { return {
type: ActionTypes.SET_UNREAD_FILTER_ENABLED, type: ActionTypes.SET_UNREAD_FILTER_ENABLED,

View File

@ -8,6 +8,10 @@ import {
} from 'mattermost-redux/actions/posts'; } from 'mattermost-redux/actions/posts';
import {Posts} from 'mattermost-redux/constants'; import {Posts} from 'mattermost-redux/constants';
import {executeCommand} from 'actions/command';
import * as HookActions from 'actions/hooks';
import * as PostActions from 'actions/post_actions';
import {setGlobalItem, actionOnGlobalItemsWithPrefix} from 'actions/storage';
import { import {
clearCommentDraftUploads, clearCommentDraftUploads,
updateCommentDraft, updateCommentDraft,
@ -19,13 +23,9 @@ import {
makeOnEditLatestPost, makeOnEditLatestPost,
} from 'actions/views/create_comment'; } from 'actions/views/create_comment';
import {removeDraft, setGlobalDraftSource} from 'actions/views/drafts'; import {removeDraft, setGlobalDraftSource} from 'actions/views/drafts';
import {setGlobalItem, actionOnGlobalItemsWithPrefix} from 'actions/storage';
import * as PostActions from 'actions/post_actions';
import {executeCommand} from 'actions/command';
import * as HookActions from 'actions/hooks';
import {StoragePrefixes} from 'utils/constants';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {StoragePrefixes} from 'utils/constants';
/* eslint-disable global-require */ /* eslint-disable global-require */

View File

@ -1,17 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Post} from '@mattermost/types/posts'; import type {Post} from '@mattermost/types/posts';
import {createSelector} from 'mattermost-redux/selectors/create_selector';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {
makeGetMessageInHistoryItem,
getPost,
makeGetPostIdsForThread,
} from 'mattermost-redux/selectors/entities/posts';
import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
import { import {
removeReaction, removeReaction,
addMessageIntoHistory, addMessageIntoHistory,
@ -19,21 +10,31 @@ import {
moveHistoryIndexForward, moveHistoryIndexForward,
} from 'mattermost-redux/actions/posts'; } from 'mattermost-redux/actions/posts';
import {Posts} from 'mattermost-redux/constants'; import {Posts} from 'mattermost-redux/constants';
import {createSelector} from 'mattermost-redux/selectors/create_selector';
import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
import {
makeGetMessageInHistoryItem,
getPost,
makeGetPostIdsForThread,
} from 'mattermost-redux/selectors/entities/posts';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {isPostPendingOrFailed} from 'mattermost-redux/utils/post_utils'; import {isPostPendingOrFailed} from 'mattermost-redux/utils/post_utils';
import * as PostActions from 'actions/post_actions';
import {executeCommand} from 'actions/command'; import {executeCommand} from 'actions/command';
import {runMessageWillBePostedHooks, runSlashCommandWillBePostedHooks} from 'actions/hooks'; import {runMessageWillBePostedHooks, runSlashCommandWillBePostedHooks} from 'actions/hooks';
import * as PostActions from 'actions/post_actions';
import {actionOnGlobalItemsWithPrefix} from 'actions/storage'; import {actionOnGlobalItemsWithPrefix} from 'actions/storage';
import {updateDraft, removeDraft} from 'actions/views/drafts'; import {updateDraft, removeDraft} from 'actions/views/drafts';
import EmojiMap from 'utils/emoji_map';
import {getPostDraft} from 'selectors/rhs'; import {getPostDraft} from 'selectors/rhs';
import * as Utils from 'utils/utils';
import {Constants, StoragePrefixes} from 'utils/constants'; import {Constants, StoragePrefixes} from 'utils/constants';
import type {PostDraft} from 'types/store/draft'; import EmojiMap from 'utils/emoji_map';
import * as Utils from 'utils/utils';
import type {GlobalState} from 'types/store'; import type {GlobalState} from 'types/store';
import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {PostDraft} from 'types/store/draft';
export function clearCommentDraftUploads() { export function clearCommentDraftUploads() {
return actionOnGlobalItemsWithPrefix(StoragePrefixes.COMMENT_DRAFT, (_key: string, draft: PostDraft) => { return actionOnGlobalItemsWithPrefix(StoragePrefixes.COMMENT_DRAFT, (_key: string, draft: PostDraft) => {

View File

@ -1,17 +1,16 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {setGlobalItem} from 'actions/storage'; import {Client4} from 'mattermost-redux/client';
import {PostDraft} from 'types/store/draft';
import {StoragePrefixes} from 'utils/constants';
import mockStore from 'tests/test_store';
import {Posts, Preferences} from 'mattermost-redux/constants'; import {Posts, Preferences} from 'mattermost-redux/constants';
import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils'; import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils';
import {Client4} from 'mattermost-redux/client'; import {setGlobalItem} from 'actions/storage';
import mockStore from 'tests/test_store';
import {StoragePrefixes} from 'utils/constants';
import type {PostDraft} from 'types/store/draft';
import {removeDraft, setGlobalDraftSource, updateDraft} from './drafts'; import {removeDraft, setGlobalDraftSource, updateDraft} from './drafts';

View File

@ -3,27 +3,28 @@
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import type {Draft as ServerDraft} from '@mattermost/types/drafts';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import type {FileInfo} from '@mattermost/types/files';
import {syncedDraftsAreAllowedAndEnabled} from 'mattermost-redux/selectors/entities/preferences'; import type {PostMetadata, PostPriorityMetadata} from '@mattermost/types/posts';
import type {PreferenceType} from '@mattermost/types/preferences';
import type {UserProfile} from '@mattermost/types/users';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import Preferences from 'mattermost-redux/constants/preferences';
import {syncedDraftsAreAllowedAndEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {ActionFunc, DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {setGlobalItem} from 'actions/storage'; import {setGlobalItem} from 'actions/storage';
import {getConnectionId} from 'selectors/general';
import type {GlobalState} from 'types/store';
import {PostDraft} from 'types/store/draft';
import {getGlobalItem} from 'selectors/storage';
import {makeGetDrafts} from 'selectors/drafts'; import {makeGetDrafts} from 'selectors/drafts';
import {getConnectionId} from 'selectors/general';
import {getGlobalItem} from 'selectors/storage';
import {ActionTypes, StoragePrefixes} from 'utils/constants'; import {ActionTypes, StoragePrefixes} from 'utils/constants';
import type {Draft as ServerDraft} from '@mattermost/types/drafts'; import type {GlobalState} from 'types/store';
import type {UserProfile} from '@mattermost/types/users'; import type {PostDraft} from 'types/store/draft';
import {PostMetadata, PostPriorityMetadata} from '@mattermost/types/posts';
import {FileInfo} from '@mattermost/types/files';
import {PreferenceType} from '@mattermost/types/preferences';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import Preferences from 'mattermost-redux/constants/preferences';
type Draft = { type Draft = {
key: keyof GlobalState['storage']['storage']; key: keyof GlobalState['storage']['storage'];

View File

@ -1,12 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {searchAssociatedGroupsForReferenceLocal} from 'mattermost-redux/selectors/entities/groups';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {haveIChannelPermission} from 'mattermost-redux/selectors/entities/roles';
import {searchGroups} from 'mattermost-redux/actions/groups'; import {searchGroups} from 'mattermost-redux/actions/groups';
import Permissions from 'mattermost-redux/constants/permissions'; import Permissions from 'mattermost-redux/constants/permissions';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {searchAssociatedGroupsForReferenceLocal} from 'mattermost-redux/selectors/entities/groups';
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {haveIChannelPermission} from 'mattermost-redux/selectors/entities/roles';
export function searchAssociatedGroupsForReference(prefix, teamId, channelId) { export function searchAssociatedGroupsForReference(prefix, teamId, channelId) {
return async (dispatch, getState) => { return async (dispatch, getState) => {

View File

@ -1,15 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {MockStoreEnhanced} from 'redux-mock-store'; import type {MockStoreEnhanced} from 'redux-mock-store';
import {DispatchFunc} from 'mattermost-redux/types/actions'; import type {DispatchFunc} from 'mattermost-redux/types/actions';
import {close, open, toggle} from 'actions/views/lhs'; import {close, open, toggle} from 'actions/views/lhs';
import {ActionTypes} from 'utils/constants';
import mockStore from 'tests/test_store';
import configureStore from 'store'; import configureStore from 'store';
import {GlobalState} from 'types/store';
import mockStore from 'tests/test_store';
import {ActionTypes} from 'utils/constants';
import type {GlobalState} from 'types/store';
import * as Actions from './lhs'; import * as Actions from './lhs';

View File

@ -2,15 +2,17 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {selectChannel} from 'mattermost-redux/actions/channels'; import {selectChannel} from 'mattermost-redux/actions/channels';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {GlobalState} from 'types/store';
import {LhsItemType} from 'types/store/lhs';
import Constants, {ActionTypes} from 'utils/constants';
import {getHistory} from 'utils/browser_history';
import {SidebarSize} from 'components/resizable_sidebar/constants'; import {SidebarSize} from 'components/resizable_sidebar/constants';
import {getHistory} from 'utils/browser_history';
import Constants, {ActionTypes} from 'utils/constants';
import type {GlobalState} from 'types/store';
import {LhsItemType} from 'types/store/lhs';
export const setLhsSize = (sidebarSize?: SidebarSize) => { export const setLhsSize = (sidebarSize?: SidebarSize) => {
let newSidebarSize = sidebarSize; let newSidebarSize = sidebarSize;
if (!sidebarSize) { if (!sidebarSize) {

View File

@ -5,14 +5,14 @@ import nock from 'nock';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import TestHelper from 'packages/mattermost-redux/test/test_helper';
import { import {
login, login,
loginById, loginById,
} from 'actions/views/login'; } from 'actions/views/login';
import configureStore from 'store'; import configureStore from 'store';
import TestHelper from 'packages/mattermost-redux/test/test_helper';
describe('actions/views/login', () => { describe('actions/views/login', () => {
describe('login', () => { describe('login', () => {
test('should return successful when login is successful', async () => { test('should return successful when login is successful', async () => {

View File

@ -3,13 +3,13 @@
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {ServerError} from '@mattermost/types/errors'; import type {ServerError} from '@mattermost/types/errors';
import {Client4} from 'mattermost-redux/client';
import {ActionFunc, DispatchFunc} from 'mattermost-redux/types/actions';
import {UserTypes} from 'mattermost-redux/action_types'; import {UserTypes} from 'mattermost-redux/action_types';
import {logError} from 'mattermost-redux/actions/errors'; import {logError} from 'mattermost-redux/actions/errors';
import {loadRolesIfNeeded} from 'mattermost-redux/actions/roles'; import {loadRolesIfNeeded} from 'mattermost-redux/actions/roles';
import {Client4} from 'mattermost-redux/client';
import type {ActionFunc, DispatchFunc} from 'mattermost-redux/types/actions';
export function login(loginId: string, password: string, mfaToken = ''): ActionFunc { export function login(loginId: string, password: string, mfaToken = ''): ActionFunc {
return async (dispatch: DispatchFunc) => { return async (dispatch: DispatchFunc) => {

View File

@ -10,6 +10,7 @@ import {
deactivateMfa, deactivateMfa,
generateMfaSecret, generateMfaSecret,
} from 'actions/views/mfa'; } from 'actions/views/mfa';
import configureStore from 'tests/test_store'; import configureStore from 'tests/test_store';
describe('actions/views/mfa', () => { describe('actions/views/mfa', () => {

View File

@ -5,9 +5,10 @@ import React from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {openModal, closeModal} from 'actions/views/modals'; import {openModal, closeModal} from 'actions/views/modals';
import {ActionTypes, ModalIdentifiers} from 'utils/constants';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {ActionTypes, ModalIdentifiers} from 'utils/constants';
class TestModal extends React.PureComponent { class TestModal extends React.PureComponent {
render() { render() {
return ( return (

View File

@ -1,10 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {ModalData} from 'types/actions';
import {ActionTypes} from 'utils/constants'; import {ActionTypes} from 'utils/constants';
import type {ModalData} from 'types/actions';
export function openModal<P>(modalData: ModalData<P>) { export function openModal<P>(modalData: ModalData<P>) {
return { return {
type: ActionTypes.MODAL_OPEN, type: ActionTypes.MODAL_OPEN,

View File

@ -1,16 +1,19 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {getCurrentTeamId, getTeam} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUser, getCurrentUserId} from 'mattermost-redux/selectors/entities/common'; import {getCurrentUser, getCurrentUserId} from 'mattermost-redux/selectors/entities/common';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import {getCurrentTeamId, getTeam} from 'mattermost-redux/selectors/entities/teams';
import {GlobalState} from 'types/store'; import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getHistory} from 'utils/browser_history';
import InvitationModal from 'components/invitation_modal';
import LocalStorageStore from 'stores/local_storage_store';
import {ActionTypes, Constants, ModalIdentifiers} from 'utils/constants';
import {getTeamRedirectChannelIfIsAccesible} from 'actions/global_actions'; import {getTeamRedirectChannelIfIsAccesible} from 'actions/global_actions';
import LocalStorageStore from 'stores/local_storage_store';
import InvitationModal from 'components/invitation_modal';
import {getHistory} from 'utils/browser_history';
import {ActionTypes, Constants, ModalIdentifiers} from 'utils/constants';
import type {GlobalState} from 'types/store';
import {openModal} from './modals'; import {openModal} from './modals';

View File

@ -1,22 +1,22 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import * as PostActions from 'mattermost-redux/actions/posts';
import {Permissions} from 'mattermost-redux/constants';
import {logError} from 'mattermost-redux/actions/errors'; import {logError} from 'mattermost-redux/actions/errors';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import * as PostActions from 'mattermost-redux/actions/posts';
import {haveIChannelPermission, haveICurrentChannelPermission} from 'mattermost-redux/selectors/entities/roles'; import {Permissions} from 'mattermost-redux/constants';
import {getLicense} from 'mattermost-redux/selectors/entities/general'; import {getLicense} from 'mattermost-redux/selectors/entities/general';
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getAssociatedGroupsForReferenceByMention} from 'mattermost-redux/selectors/entities/groups'; import {getAssociatedGroupsForReferenceByMention} from 'mattermost-redux/selectors/entities/groups';
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {haveIChannelPermission, haveICurrentChannelPermission} from 'mattermost-redux/selectors/entities/roles';
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getTimestamp} from 'utils/utils';
import {getPermalinkURL} from 'selectors/urls'; import {getPermalinkURL} from 'selectors/urls';
import {getSiteURL} from 'utils/url';
import {containsAtChannel, groupsMentionedInText} from 'utils/post_utils';
import {ActionTypes, AnnouncementBarTypes} from 'utils/constants'; import {ActionTypes, AnnouncementBarTypes} from 'utils/constants';
import {containsAtChannel, groupsMentionedInText} from 'utils/post_utils';
import {getSiteURL} from 'utils/url';
import {getTimestamp} from 'utils/utils';
import {runMessageWillBePostedHooks} from '../hooks'; import {runMessageWillBePostedHooks} from '../hooks';

View File

@ -1,10 +1,9 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {getTeamMember} from 'mattermost-redux/actions/teams';
import {getChannelMember} from 'mattermost-redux/actions/channels'; import {getChannelMember} from 'mattermost-redux/actions/channels';
import {getTeamMember} from 'mattermost-redux/actions/teams';
import {DispatchFunc} from 'mattermost-redux/types/actions'; import type {DispatchFunc} from 'mattermost-redux/types/actions';
export function getMembershipForEntities(teamId: string, userId: string, channelId?: string) { export function getMembershipForEntities(teamId: string, userId: string, channelId?: string) {
return (dispatch: DispatchFunc) => { return (dispatch: DispatchFunc) => {

View File

@ -3,16 +3,18 @@
import {cloneDeep, set} from 'lodash'; import {cloneDeep, set} from 'lodash';
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import {MockStoreEnhanced} from 'redux-mock-store'; import type {MockStoreEnhanced} from 'redux-mock-store';
import type {Post} from '@mattermost/types/posts';
import type {UserProfile} from '@mattermost/types/users';
import type {IDMappedObjects} from '@mattermost/types/utilities';
import {SearchTypes} from 'mattermost-redux/action_types';
import * as PostActions from 'mattermost-redux/actions/posts'; import * as PostActions from 'mattermost-redux/actions/posts';
import * as SearchActions from 'mattermost-redux/actions/search'; import * as SearchActions from 'mattermost-redux/actions/search';
import {SearchTypes} from 'mattermost-redux/action_types'; import type {DispatchFunc} from 'mattermost-redux/types/actions';
import {DispatchFunc} from 'mattermost-redux/types/actions';
import {Post} from '@mattermost/types/posts';
import {UserProfile} from '@mattermost/types/users';
import {IDMappedObjects} from '@mattermost/types/utilities';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import { import {
updateRhsState, updateRhsState,
selectPostFromRightHandSideSearch, selectPostFromRightHandSideSearch,
@ -38,15 +40,15 @@ import {
showChannelMembers, showChannelMembers,
openShowEditHistory, openShowEditHistory,
} from 'actions/views/rhs'; } from 'actions/views/rhs';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {ActionTypes, RHSStates, Constants} from 'utils/constants'; import {ActionTypes, RHSStates, Constants} from 'utils/constants';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
import {getBrowserUtcOffset} from 'utils/timezone'; import {getBrowserUtcOffset} from 'utils/timezone';
import {GlobalState} from 'types/store'; import type {GlobalState} from 'types/store';
import {ViewsState} from 'types/store/views'; import type {RhsState} from 'types/store/rhs';
import {RhsState} from 'types/store/rhs'; import type {ViewsState} from 'types/store/views';
const currentChannelId = '123'; const currentChannelId = '123';
const currentTeamId = '321'; const currentTeamId = '321';

View File

@ -2,10 +2,15 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import {AnyAction} from 'redux'; import type {AnyAction} from 'redux';
import {batchActions} from 'redux-batched-actions'; import {batchActions} from 'redux-batched-actions';
import type {Post} from '@mattermost/types/posts';
import {SearchTypes} from 'mattermost-redux/action_types'; import {SearchTypes} from 'mattermost-redux/action_types';
import {getChannel} from 'mattermost-redux/actions/channels';
import * as PostActions from 'mattermost-redux/actions/posts';
import {getPostsByIds, getPost as fetchPost} from 'mattermost-redux/actions/posts';
import { import {
clearSearch, clearSearch,
getFlaggedPosts, getFlaggedPosts,
@ -13,26 +18,24 @@ import {
searchPostsWithParams, searchPostsWithParams,
searchFilesWithParams, searchFilesWithParams,
} from 'mattermost-redux/actions/search'; } from 'mattermost-redux/actions/search';
import * as PostActions from 'mattermost-redux/actions/posts';
import {getCurrentUserMentionKeys} from 'mattermost-redux/selectors/entities/users';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getCurrentChannelId, getCurrentChannelNameForSearchShortcut, getChannel as getChannelSelector} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannelId, getCurrentChannelNameForSearchShortcut, getChannel as getChannelSelector} from 'mattermost-redux/selectors/entities/channels';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getPost} from 'mattermost-redux/selectors/entities/posts'; import {getPost} from 'mattermost-redux/selectors/entities/posts';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentTimezone} from 'mattermost-redux/selectors/entities/timezone'; import {getCurrentTimezone} from 'mattermost-redux/selectors/entities/timezone';
import {Action, ActionResult, DispatchFunc, GenericAction, GetStateFunc} from 'mattermost-redux/types/actions'; import {getCurrentUserMentionKeys} from 'mattermost-redux/selectors/entities/users';
import {Post} from '@mattermost/types/posts'; import type {Action, ActionResult, DispatchFunc, GenericAction, GetStateFunc} from 'mattermost-redux/types/actions';
import {trackEvent} from 'actions/telemetry_actions.jsx'; import {trackEvent} from 'actions/telemetry_actions.jsx';
import {getSearchTerms, getRhsState, getPluggableId, getFilesSearchExtFilter, getPreviousRhsState} from 'selectors/rhs'; import {getSearchTerms, getRhsState, getPluggableId, getFilesSearchExtFilter, getPreviousRhsState} from 'selectors/rhs';
import {SidebarSize} from 'components/resizable_sidebar/constants';
import {ActionTypes, RHSStates, Constants} from 'utils/constants'; import {ActionTypes, RHSStates, Constants} from 'utils/constants';
import {getBrowserUtcOffset, getUtcOffsetForTimeZone} from 'utils/timezone'; import {getBrowserUtcOffset, getUtcOffsetForTimeZone} from 'utils/timezone';
import {RhsState} from 'types/store/rhs';
import {GlobalState} from 'types/store';
import {getPostsByIds, getPost as fetchPost} from 'mattermost-redux/actions/posts';
import {getChannel} from 'mattermost-redux/actions/channels'; import type {GlobalState} from 'types/store';
import {SidebarSize} from 'components/resizable_sidebar/constants'; import type {RhsState} from 'types/store/rhs';
function selectPostFromRightHandSideSearchWithPreviousState(post: Post, previousRhsState?: RhsState) { function selectPostFromRightHandSideSearchWithPreviousState(post: Post, previousRhsState?: RhsState) {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => { return async (dispatch: DispatchFunc, getState: GetStateFunc) => {

View File

@ -1,11 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {ActionTypes} from 'utils/constants';
import * as Actions from 'actions/views/root'; import * as Actions from 'actions/views/root';
import * as i18nSelectors from 'selectors/i18n'; import * as i18nSelectors from 'selectors/i18n';
import mockStore from 'tests/test_store'; import mockStore from 'tests/test_store';
import {ActionTypes} from 'utils/constants';
jest.mock('mattermost-redux/actions/general', () => { jest.mock('mattermost-redux/actions/general', () => {
const original = jest.requireActual('mattermost-redux/actions/general'); const original = jest.requireActual('mattermost-redux/actions/general');

View File

@ -1,16 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {Client4} from 'mattermost-redux/client';
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general'; import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
import {loadMe, loadMeREST} from 'mattermost-redux/actions/users'; import {loadMe, loadMeREST} from 'mattermost-redux/actions/users';
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions'; import {Client4} from 'mattermost-redux/client';
import {GlobalState} from 'types/store'; import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
import {getCurrentLocale, getTranslations} from 'selectors/i18n'; import {getCurrentLocale, getTranslations} from 'selectors/i18n';
import {Translations} from 'types/store/i18n';
import {ActionTypes} from 'utils/constants';
import en from 'i18n/en.json'; import en from 'i18n/en.json';
import {ActionTypes} from 'utils/constants';
import type {GlobalState} from 'types/store';
import type {Translations} from 'types/store/i18n';
const pluginTranslationSources: Record<string, TranslationPluginFunction> = {}; const pluginTranslationSources: Record<string, TranslationPluginFunction> = {};

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {ActionTypes} from '../../utils/constants'; import {ActionTypes} from 'utils/constants';
export function setShowPreviewOnCreateComment(showPreview) { export function setShowPreviewOnCreateComment(showPreview) {
return { return {

View File

@ -21,7 +21,8 @@ import {
CloudTypes, CloudTypes,
HostedCustomerTypes, HostedCustomerTypes,
} from 'mattermost-redux/action_types'; } from 'mattermost-redux/action_types';
import {General, Permissions} from 'mattermost-redux/constants'; import {getStandardAnalytics} from 'mattermost-redux/actions/admin';
import {fetchAppBindings, fetchRHSAppsBindings} from 'mattermost-redux/actions/apps';
import {addChannelToInitialCategory, fetchMyCategories, receivedCategoryOrder} from 'mattermost-redux/actions/channel_categories'; import {addChannelToInitialCategory, fetchMyCategories, receivedCategoryOrder} from 'mattermost-redux/actions/channel_categories';
import { import {
getChannelAndMyMember, getChannelAndMyMember,
@ -31,11 +32,21 @@ import {
getChannelMemberCountsByGroup, getChannelMemberCountsByGroup,
} from 'mattermost-redux/actions/channels'; } from 'mattermost-redux/actions/channels';
import {getCloudSubscription} from 'mattermost-redux/actions/cloud'; import {getCloudSubscription} from 'mattermost-redux/actions/cloud';
import {clearErrors, logError} from 'mattermost-redux/actions/errors';
import {setServerVersion, getClientConfig} from 'mattermost-redux/actions/general';
import {getGroup as fetchGroup} from 'mattermost-redux/actions/groups';
import {
getCustomEmojiForReaction,
getPosts,
getPostThread,
getMentionsAndStatusesForPosts,
getThreadsForPosts,
postDeleted,
receivedNewPost,
receivedPost,
} from 'mattermost-redux/actions/posts';
import {loadRolesIfNeeded} from 'mattermost-redux/actions/roles'; import {loadRolesIfNeeded} from 'mattermost-redux/actions/roles';
import * as TeamActions from 'mattermost-redux/actions/teams';
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getNewestThreadInTeam, getThread, getThreads} from 'mattermost-redux/selectors/entities/threads';
import {getGroup} from 'mattermost-redux/selectors/entities/groups';
import { import {
getThread as fetchThread, getThread as fetchThread,
getCountsAndThreadsSince, getCountsAndThreadsSince,
@ -47,34 +58,14 @@ import {
updateThreadRead, updateThreadRead,
decrementThreadCounts, decrementThreadCounts,
} from 'mattermost-redux/actions/threads'; } from 'mattermost-redux/actions/threads';
import {setServerVersion, getClientConfig} from 'mattermost-redux/actions/general';
import {
getCustomEmojiForReaction,
getPosts,
getPostThread,
getMentionsAndStatusesForPosts,
getThreadsForPosts,
postDeleted,
receivedNewPost,
receivedPost,
} from 'mattermost-redux/actions/posts';
import {clearErrors, logError} from 'mattermost-redux/actions/errors';
import * as TeamActions from 'mattermost-redux/actions/teams';
import { import {
checkForModifiedUsers, checkForModifiedUsers,
getUser as loadUser, getUser as loadUser,
} from 'mattermost-redux/actions/users'; } from 'mattermost-redux/actions/users';
import {getGroup as fetchGroup} from 'mattermost-redux/actions/groups';
import {removeNotVisibleUsers} from 'mattermost-redux/actions/websocket'; import {removeNotVisibleUsers} from 'mattermost-redux/actions/websocket';
import {setGlobalItem} from 'actions/storage';
import {setGlobalDraft, transformServerDraft} from 'actions/views/drafts';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {getCurrentUser, getCurrentUserId, getUser, getIsManualStatusForUserId, isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users'; import {General, Permissions} from 'mattermost-redux/constants';
import {getMyTeams, getCurrentRelativeTeamUrl, getCurrentTeamId, getCurrentTeamUrl, getTeam} from 'mattermost-redux/selectors/entities/teams'; import {appsFeatureFlagEnabled} from 'mattermost-redux/selectors/entities/apps';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
import { import {
getChannel, getChannel,
getChannelMembersInChannels, getChannelMembersInChannels,
@ -83,41 +74,45 @@ import {
getCurrentChannelId, getCurrentChannelId,
getRedirectChannelNameForTeam, getRedirectChannelNameForTeam,
} from 'mattermost-redux/selectors/entities/channels'; } from 'mattermost-redux/selectors/entities/channels';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
import {getGroup} from 'mattermost-redux/selectors/entities/groups';
import {getPost, getMostRecentPostIdInChannel, getTeamIdFromPost} from 'mattermost-redux/selectors/entities/posts'; import {getPost, getMostRecentPostIdInChannel, getTeamIdFromPost} from 'mattermost-redux/selectors/entities/posts';
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {haveISystemPermission, haveITeamPermission} from 'mattermost-redux/selectors/entities/roles'; import {haveISystemPermission, haveITeamPermission} from 'mattermost-redux/selectors/entities/roles';
import {appsFeatureFlagEnabled} from 'mattermost-redux/selectors/entities/apps'; import {getMyTeams, getCurrentRelativeTeamUrl, getCurrentTeamId, getCurrentTeamUrl, getTeam} from 'mattermost-redux/selectors/entities/teams';
import {getStandardAnalytics} from 'mattermost-redux/actions/admin'; import {getNewestThreadInTeam, getThread, getThreads} from 'mattermost-redux/selectors/entities/threads';
import {getCurrentUser, getCurrentUserId, getUser, getIsManualStatusForUserId, isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
import {fetchAppBindings, fetchRHSAppsBindings} from 'mattermost-redux/actions/apps';
import {getSelectedChannelId, getSelectedPost} from 'selectors/rhs';
import {isThreadOpen, isThreadManuallyUnread} from 'selectors/views/threads';
import {openModal} from 'actions/views/modals';
import {incrementWsErrorCount, resetWsErrorCount} from 'actions/views/system';
import {closeRightHandSide} from 'actions/views/rhs';
import {syncPostsInChannel} from 'actions/views/channel';
import {updateThreadLastOpened} from 'actions/views/threads';
import {getHistory} from 'utils/browser_history';
import {loadChannelsForCurrentUser} from 'actions/channel_actions';
import {loadCustomEmojisIfNeeded} from 'actions/emoji_actions';
import {redirectUserToDefaultTeam} from 'actions/global_actions';
import {handleNewPost} from 'actions/post_actions';
import * as StatusActions from 'actions/status_actions';
import {loadProfilesForSidebar} from 'actions/user_actions';
import {sendDesktopNotification} from 'actions/notification_actions.jsx';
import store from 'stores/redux_store.jsx';
import WebSocketClient from 'client/web_websocket_client.jsx';
import {loadPlugin, loadPluginsIfNecessary, removePlugin} from 'plugins';
import {ActionTypes, Constants, AnnouncementBarMessages, SocketEvents, UserStatuses, ModalIdentifiers, WarnMetricTypes} from 'utils/constants';
import {getSiteURL} from 'utils/url';
import {isGuest} from 'mattermost-redux/utils/user_utils'; import {isGuest} from 'mattermost-redux/utils/user_utils';
import RemovedFromChannelModal from 'components/removed_from_channel_modal';
import InteractiveDialog from 'components/interactive_dialog'; import {loadChannelsForCurrentUser} from 'actions/channel_actions';
import { import {
getTeamsUsage, getTeamsUsage,
} from 'actions/cloud'; } from 'actions/cloud';
import {loadCustomEmojisIfNeeded} from 'actions/emoji_actions';
import {redirectUserToDefaultTeam} from 'actions/global_actions';
import {sendDesktopNotification} from 'actions/notification_actions.jsx';
import {handleNewPost} from 'actions/post_actions';
import * as StatusActions from 'actions/status_actions';
import {setGlobalItem} from 'actions/storage';
import {loadProfilesForSidebar} from 'actions/user_actions';
import {syncPostsInChannel} from 'actions/views/channel';
import {setGlobalDraft, transformServerDraft} from 'actions/views/drafts';
import {openModal} from 'actions/views/modals';
import {closeRightHandSide} from 'actions/views/rhs';
import {incrementWsErrorCount, resetWsErrorCount} from 'actions/views/system';
import {updateThreadLastOpened} from 'actions/views/threads';
import {getSelectedChannelId, getSelectedPost} from 'selectors/rhs';
import {isThreadOpen, isThreadManuallyUnread} from 'selectors/views/threads';
import store from 'stores/redux_store.jsx';
import InteractiveDialog from 'components/interactive_dialog';
import RemovedFromChannelModal from 'components/removed_from_channel_modal';
import WebSocketClient from 'client/web_websocket_client.jsx';
import {loadPlugin, loadPluginsIfNecessary, removePlugin} from 'plugins';
import {getHistory} from 'utils/browser_history';
import {ActionTypes, Constants, AnnouncementBarMessages, SocketEvents, UserStatuses, ModalIdentifiers, WarnMetricTypes} from 'utils/constants';
import {getSiteURL} from 'utils/url';
const dispatch = store.dispatch; const dispatch = store.dispatch;
const getState = store.getState; const getState = store.getState;

View File

@ -1,28 +1,25 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {ChannelTypes, UserTypes, CloudTypes} from 'mattermost-redux/action_types';
import {getGroup} from 'mattermost-redux/actions/groups';
import { import {
getMentionsAndStatusesForPosts, getMentionsAndStatusesForPosts,
getThreadsForPosts, getThreadsForPosts,
receivedNewPost, receivedNewPost,
} from 'mattermost-redux/actions/posts'; } from 'mattermost-redux/actions/posts';
import {getGroup} from 'mattermost-redux/actions/groups';
import {ChannelTypes, UserTypes, CloudTypes} from 'mattermost-redux/action_types';
import {getUser} from 'mattermost-redux/actions/users'; import {getUser} from 'mattermost-redux/actions/users';
import {handleNewPost} from 'actions/post_actions'; import {handleNewPost} from 'actions/post_actions';
import {closeRightHandSide} from 'actions/views/rhs';
import {syncPostsInChannel} from 'actions/views/channel'; import {syncPostsInChannel} from 'actions/views/channel';
import {closeRightHandSide} from 'actions/views/rhs';
import store from 'stores/redux_store.jsx'; import store from 'stores/redux_store.jsx';
import mergeObjects from 'packages/mattermost-redux/test/merge_objects';
import configureStore from 'tests/test_store'; import configureStore from 'tests/test_store';
import {getHistory} from 'utils/browser_history'; import {getHistory} from 'utils/browser_history';
import Constants, {SocketEvents, UserStatuses, ActionTypes} from 'utils/constants'; import Constants, {SocketEvents, UserStatuses, ActionTypes} from 'utils/constants';
import mergeObjects from 'packages/mattermost-redux/test/merge_objects';
import { import {
handleChannelUpdatedEvent, handleChannelUpdatedEvent,
handleEvent, handleEvent,

View File

@ -3,12 +3,11 @@
import React from 'react'; import React from 'react';
import {ClientConfig, ClientLicense} from '@mattermost/types/config'; import type {ClientConfig, ClientLicense} from '@mattermost/types/config';
import AboutBuildModal from 'components/about_build_modal/about_build_modal'; import AboutBuildModal from 'components/about_build_modal/about_build_modal';
import {renderWithFullContext, screen, userEvent} from 'tests/react_testing_utils'; import {renderWithFullContext, screen, userEvent} from 'tests/react_testing_utils';
import {AboutLinks} from 'utils/constants'; import {AboutLinks} from 'utils/constants';
import AboutBuildModalCloud from './about_build_modal_cloud/about_build_modal_cloud'; import AboutBuildModalCloud from './about_build_modal_cloud/about_build_modal_cloud';

View File

@ -5,14 +5,13 @@ import React from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {ClientConfig, ClientLicense} from '@mattermost/types/config'; import type {ClientConfig, ClientLicense} from '@mattermost/types/config';
import MattermostLogo from 'components/widgets/icons/mattermost_logo';
import Nbsp from 'components/html_entities/nbsp';
import {AboutLinks} from 'utils/constants';
import ExternalLink from 'components/external_link'; import ExternalLink from 'components/external_link';
import Nbsp from 'components/html_entities/nbsp';
import MattermostLogo from 'components/widgets/icons/mattermost_logo';
import {AboutLinks} from 'utils/constants';
import AboutBuildModalCloud from './about_build_modal_cloud/about_build_modal_cloud'; import AboutBuildModalCloud from './about_build_modal_cloud/about_build_modal_cloud';

View File

@ -1,17 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import classNames from 'classnames';
import React from 'react'; import React from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import classNames from 'classnames';
import {useSelector} from 'react-redux'; import {useSelector} from 'react-redux';
import ExternalLink from 'components/external_link';
import MattermostLogo from 'components/widgets/icons/mattermost_logo'; import MattermostLogo from 'components/widgets/icons/mattermost_logo';
import {GlobalState} from 'types/store';
import type {GlobalState} from 'types/store';
import './about_build_modal_cloud.scss'; import './about_build_modal_cloud.scss';
import ExternalLink from 'components/external_link';
type Props = { type Props = {
onExited: () => void; onExited: () => void;

View File

@ -5,7 +5,7 @@ import {connect} from 'react-redux';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general'; import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
import {GlobalState} from 'types/store'; import type {GlobalState} from 'types/store';
import AboutBuildModal from './about_build_modal'; import AboutBuildModal from './about_build_modal';

View File

@ -1,14 +1,15 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react'; import {fireEvent, screen, render, waitForElementToBeRemoved, waitFor} from '@testing-library/react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import AccessHistoryModal from 'components/access_history_modal/access_history_modal'; import AccessHistoryModal from 'components/access_history_modal/access_history_modal';
import AuditTable from 'components/audit_table'; import AuditTable from 'components/audit_table';
import LoadingScreen from 'components/loading_screen'; import LoadingScreen from 'components/loading_screen';
import {withIntl} from 'tests/helpers/intl-test-helper'; import {withIntl} from 'tests/helpers/intl-test-helper';
import {fireEvent, screen, render, waitForElementToBeRemoved, waitFor} from '@testing-library/react';
describe('components/AccessHistoryModal', () => { describe('components/AccessHistoryModal', () => {
const baseProps = { const baseProps = {

View File

@ -5,9 +5,10 @@ import React, {useCallback, useEffect, useState} from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import type {Audit} from '@mattermost/types/audits';
import AuditTable from 'components/audit_table'; import AuditTable from 'components/audit_table';
import LoadingScreen from 'components/loading_screen'; import LoadingScreen from 'components/loading_screen';
import {Audit} from '@mattermost/types/audits';
type Props = { type Props = {
onHide: () => void; onHide: () => void;

View File

@ -2,13 +2,14 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {Dispatch} from 'redux';
import {getUserAudits} from 'mattermost-redux/actions/users'; import {getUserAudits} from 'mattermost-redux/actions/users';
import {getCurrentUserId, getUserAudits as getCurrentUserAudits} from 'mattermost-redux/selectors/entities/users'; import {getCurrentUserId, getUserAudits as getCurrentUserAudits} from 'mattermost-redux/selectors/entities/users';
import {GenericAction} from 'mattermost-redux/types/actions'; import type {GenericAction} from 'mattermost-redux/types/actions';
import {GlobalState} from 'types/store'; import type {GlobalState} from 'types/store';
import AccessHistoryModal from './access_history_modal'; import AccessHistoryModal from './access_history_modal';

View File

@ -3,14 +3,15 @@
import React from 'react'; import React from 'react';
import {PostType} from '@mattermost/types/posts'; import type {PostType} from '@mattermost/types/posts';
import {PluginComponent} from 'types/store/plugins';
import {shallowWithIntl} from 'tests/helpers/intl-test-helper'; import {shallowWithIntl} from 'tests/helpers/intl-test-helper';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
import ActionsMenu, {PLUGGABLE_COMPONENT, Props} from './actions_menu'; import type {PluginComponent} from 'types/store/plugins';
import ActionsMenu, {PLUGGABLE_COMPONENT} from './actions_menu';
import type {Props} from './actions_menu';
jest.mock('utils/utils', () => { jest.mock('utils/utils', () => {
const original = jest.requireActual('utils/utils'); const original = jest.requireActual('utils/utils');

View File

@ -1,33 +1,37 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import {FormattedMessage, injectIntl, IntlShape} from 'react-intl'; import React from 'react';
import './actions_menu.scss';
import {Tooltip} from 'react-bootstrap'; import {Tooltip} from 'react-bootstrap';
import {FormattedMessage, injectIntl} from 'react-intl';
import type {IntlShape} from 'react-intl';
import type {AppBinding} from '@mattermost/types/apps';
import type {Post} from '@mattermost/types/posts';
import {AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import Permissions from 'mattermost-redux/constants/permissions';
import FormattedMarkdownMessage from 'components/formatted_markdown_message'; import FormattedMarkdownMessage from 'components/formatted_markdown_message';
import {Post} from '@mattermost/types/posts';
import {AppBinding} from '@mattermost/types/apps';
import {AppCallResponseTypes} from 'mattermost-redux/constants/apps';
import {HandleBindingClick, PostEphemeralCallResponseForPost, OpenAppsModal} from 'types/apps';
import {Locations, Constants, ModalIdentifiers} from 'utils/constants';
import Permissions from 'mattermost-redux/constants/permissions';
import {ModalData} from 'types/actions';
import MarketplaceModal, {OpenedFromType} from 'components/plugin_marketplace/marketplace_modal';
import OverlayTrigger from 'components/overlay_trigger'; import OverlayTrigger from 'components/overlay_trigger';
import * as PostUtils from 'utils/post_utils';
import * as Utils from 'utils/utils';
import SystemPermissionGate from 'components/permissions_gates/system_permission_gate'; import SystemPermissionGate from 'components/permissions_gates/system_permission_gate';
import Pluggable from 'plugins/pluggable'; import MarketplaceModal from 'components/plugin_marketplace/marketplace_modal';
import type {OpenedFromType} from 'components/plugin_marketplace/marketplace_modal';
import Menu from 'components/widgets/menu/menu'; import Menu from 'components/widgets/menu/menu';
import MenuWrapper from 'components/widgets/menu/menu_wrapper'; import MenuWrapper from 'components/widgets/menu/menu_wrapper';
import {PluginComponent} from 'types/store/plugins';
import Pluggable from 'plugins/pluggable';
import {createCallContext} from 'utils/apps'; import {createCallContext} from 'utils/apps';
import {Locations, Constants, ModalIdentifiers} from 'utils/constants';
import * as PostUtils from 'utils/post_utils';
import * as Utils from 'utils/utils';
import type {ModalData} from 'types/actions';
import type {HandleBindingClick, PostEphemeralCallResponseForPost, OpenAppsModal} from 'types/apps';
import type {PluginComponent} from 'types/store/plugins';
import './actions_menu.scss';
import {ActionsMenuIcon} from './actions_menu_icon'; import {ActionsMenuIcon} from './actions_menu_icon';

View File

@ -4,7 +4,9 @@
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react'; import React from 'react';
import ActionsMenu, {Props} from 'components/actions_menu/actions_menu'; import ActionsMenu from 'components/actions_menu/actions_menu';
import type {Props} from 'components/actions_menu/actions_menu';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
jest.mock('utils/utils', () => { jest.mock('utils/utils', () => {

View File

@ -4,7 +4,9 @@
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react'; import React from 'react';
import ActionsMenu, {Props} from 'components/actions_menu/actions_menu'; import ActionsMenu from 'components/actions_menu/actions_menu';
import type {Props} from 'components/actions_menu/actions_menu';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
jest.mock('utils/utils', () => { jest.mock('utils/utils', () => {

View File

@ -1,34 +1,33 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {ComponentProps} from 'react'; import type {ComponentProps} from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users'; import type {AppBinding} from '@mattermost/types/apps';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams'; import type {Post} from '@mattermost/types/posts';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {AppBindingLocations} from 'mattermost-redux/constants/apps';
import {isSystemAdmin} from 'mattermost-redux/utils/user_utils';
import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
import {isCombinedUserActivityPost} from 'mattermost-redux/utils/post_list';
import {GenericAction} from 'mattermost-redux/types/actions';
import {ModalData} from 'types/actions';
import {getIsMobileView} from 'selectors/views/browser';
import {AppBinding} from '@mattermost/types/apps';
import {Post} from '@mattermost/types/posts';
import {HandleBindingClick, OpenAppsModal, PostEphemeralCallResponseForPost} from 'types/apps';
import {GlobalState} from 'types/store';
import {openModal} from 'actions/views/modals';
import {makeFetchBindings, postEphemeralCallResponseForPost, handleBindingClick, openAppsModal} from 'actions/apps';
import {Permissions} from 'mattermost-redux/constants'; import {Permissions} from 'mattermost-redux/constants';
import {AppBindingLocations} from 'mattermost-redux/constants/apps';
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
import {isMarketplaceEnabled} from 'mattermost-redux/selectors/entities/general'; import {isMarketplaceEnabled} from 'mattermost-redux/selectors/entities/general';
import {haveICurrentTeamPermission} from 'mattermost-redux/selectors/entities/roles'; import {haveICurrentTeamPermission} from 'mattermost-redux/selectors/entities/roles';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import type {GenericAction} from 'mattermost-redux/types/actions';
import {isCombinedUserActivityPost} from 'mattermost-redux/utils/post_list';
import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
import {isSystemAdmin} from 'mattermost-redux/utils/user_utils';
import {makeFetchBindings, postEphemeralCallResponseForPost, handleBindingClick, openAppsModal} from 'actions/apps';
import {openModal} from 'actions/views/modals';
import {getIsMobileView} from 'selectors/views/browser';
import type {ModalData} from 'types/actions';
import type {HandleBindingClick, OpenAppsModal, PostEphemeralCallResponseForPost} from 'types/apps';
import type {GlobalState} from 'types/store';
import ActionsMenu from './actions_menu'; import ActionsMenu from './actions_menu';
import {makeGetPostOptionBinding} from './selectors'; import {makeGetPostOptionBinding} from './selectors';

View File

@ -1,15 +1,16 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {AppBinding} from '@mattermost/types/apps'; import type {AppBinding} from '@mattermost/types/apps';
import {createSelector} from 'mattermost-redux/selectors/create_selector';
import {AppBindingLocations} from 'mattermost-redux/constants/apps'; import {AppBindingLocations} from 'mattermost-redux/constants/apps';
import {createSelector} from 'mattermost-redux/selectors/create_selector';
import {makeAppBindingsSelector, makeRHSAppBindingSelector} from 'mattermost-redux/selectors/entities/apps'; import {makeAppBindingsSelector, makeRHSAppBindingSelector} from 'mattermost-redux/selectors/entities/apps';
import {GlobalState} from 'types/store';
import {Locations} from 'utils/constants'; import {Locations} from 'utils/constants';
import type {GlobalState} from 'types/store';
export function makeGetPostOptionBinding(): (state: GlobalState, location?: string) => AppBinding[] | null { export function makeGetPostOptionBinding(): (state: GlobalState, location?: string) => AppBinding[] | null {
const centerBindingsSelector = makeAppBindingsSelector(AppBindingLocations.POST_MENU_ITEM); const centerBindingsSelector = makeAppBindingsSelector(AppBindingLocations.POST_MENU_ITEM);
const rhsBindingsSelector = makeRHSAppBindingSelector(AppBindingLocations.POST_MENU_ITEM); const rhsBindingsSelector = makeRHSAppBindingSelector(AppBindingLocations.POST_MENU_ITEM);

View File

@ -1,13 +1,14 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React, {MouseEvent} from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import ActivityLogModal from 'components/activity_log_modal/activity_log_modal'; import type {MouseEvent} from 'react';
import {General} from 'mattermost-redux/constants'; import {General} from 'mattermost-redux/constants';
import ActivityLogModal from 'components/activity_log_modal/activity_log_modal';
describe('components/ActivityLogModal', () => { describe('components/ActivityLogModal', () => {
const baseProps = { const baseProps = {
sessions: [], sessions: [],

View File

@ -5,8 +5,9 @@ import React from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {Session} from '@mattermost/types/sessions'; import type {Session} from '@mattermost/types/sessions';
import {ActionFunc} from 'mattermost-redux/types/actions';
import type {ActionFunc} from 'mattermost-redux/types/actions';
import ActivityLog from 'components/activity_log_modal/components/activity_log'; import ActivityLog from 'components/activity_log_modal/components/activity_log';

View File

@ -1,15 +1,16 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {General} from 'mattermost-redux/constants'; import {General} from 'mattermost-redux/constants';
import {localizeMessage} from 'utils/utils';
import ActivityLog from 'components/activity_log_modal/components/activity_log'; import ActivityLog from 'components/activity_log_modal/components/activity_log';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
import {localizeMessage} from 'utils/utils';
describe('components/activity_log_modal/ActivityLog', () => { describe('components/activity_log_modal/ActivityLog', () => {
const baseProps = { const baseProps = {

View File

@ -4,11 +4,12 @@
import React from 'react'; import React from 'react';
import {FormattedDate, FormattedMessage, FormattedTime} from 'react-intl'; import {FormattedDate, FormattedMessage, FormattedTime} from 'react-intl';
import {General} from 'mattermost-redux/constants'; import type {Session} from '@mattermost/types/sessions';
import {Session} from '@mattermost/types/sessions';
import {General} from 'mattermost-redux/constants';
import {localizeMessage} from 'utils/utils';
import {getMonthLong, t} from 'utils/i18n'; import {getMonthLong, t} from 'utils/i18n';
import {localizeMessage} from 'utils/utils';
import MoreInfo from './more_info'; import MoreInfo from './more_info';

View File

@ -1,12 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import {General} from 'mattermost-redux/constants'; import {General} from 'mattermost-redux/constants';
import MoreInfo from 'components/activity_log_modal/components/more_info'; import MoreInfo from 'components/activity_log_modal/components/more_info';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
describe('components/activity_log_modal/MoreInfo', () => { describe('components/activity_log_modal/MoreInfo', () => {

View File

@ -4,7 +4,7 @@
import React from 'react'; import React from 'react';
import {FormattedDate, FormattedMessage, FormattedTime} from 'react-intl'; import {FormattedDate, FormattedMessage, FormattedTime} from 'react-intl';
import {Session} from '@mattermost/types/sessions'; import type {Session} from '@mattermost/types/sessions';
import {getMonthLong} from 'utils/i18n'; import {getMonthLong} from 'utils/i18n';

View File

@ -2,16 +2,19 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import {getSessions, revokeSession} from 'mattermost-redux/actions/users'; import {getSessions, revokeSession} from 'mattermost-redux/actions/users';
import {getCurrentUserId, getUserSessions} from 'mattermost-redux/selectors/entities/users'; import {getCurrentUserId, getUserSessions} from 'mattermost-redux/selectors/entities/users';
import {ActionFunc, GenericAction} from 'mattermost-redux/types/actions'; import type {ActionFunc, GenericAction} from 'mattermost-redux/types/actions';
import {getCurrentLocale} from 'selectors/i18n'; import {getCurrentLocale} from 'selectors/i18n';
import {GlobalState} from 'types/store';
import ActivityLogModal, {Props} from './activity_log_modal'; import type {GlobalState} from 'types/store';
import ActivityLogModal from './activity_log_modal';
import type {Props} from './activity_log_modal';
function mapStateToProps(state: GlobalState) { function mapStateToProps(state: GlobalState) {
return { return {

View File

@ -1,12 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import {SyncableType} from '@mattermost/types/groups'; import {SyncableType} from '@mattermost/types/groups';
import AddGroupsToChannelModal, {Props} from 'components/add_groups_to_channel_modal/add_groups_to_channel_modal'; import AddGroupsToChannelModal from 'components/add_groups_to_channel_modal/add_groups_to_channel_modal';
import type {Props} from 'components/add_groups_to_channel_modal/add_groups_to_channel_modal';
describe('components/AddGroupsToChannelModal', () => { describe('components/AddGroupsToChannelModal', () => {
const baseProps: Props = { const baseProps: Props = {

View File

@ -5,19 +5,20 @@ import React from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {Group, SyncablePatch, SyncableType} from '@mattermost/types/groups'; import type {ServerError} from '@mattermost/types/errors';
import type {Group, SyncablePatch} from '@mattermost/types/groups';
import {SyncableType} from '@mattermost/types/groups';
import {ActionFunc} from 'mattermost-redux/types/actions'; import type {ActionFunc} from 'mattermost-redux/types/actions';
import {ServerError} from '@mattermost/types/errors'; import MultiSelect from 'components/multiselect/multiselect';
import type {Value} from 'components/multiselect/multiselect';
import AddIcon from 'components/widgets/icons/fa_add_icon';
import groupsAvatar from 'images/groups-avatar.png';
import Constants from 'utils/constants'; import Constants from 'utils/constants';
import {localizeMessage} from 'utils/utils'; import {localizeMessage} from 'utils/utils';
import MultiSelect, {Value} from 'components/multiselect/multiselect';
import groupsAvatar from 'images/groups-avatar.png';
import AddIcon from 'components/widgets/icons/fa_add_icon';
const GROUPS_PER_PAGE = 50; const GROUPS_PER_PAGE = 50;
const MAX_SELECTABLE_VALUES = 10; const MAX_SELECTABLE_VALUES = 10;

View File

@ -2,21 +2,24 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import type {Channel} from '@mattermost/types/channels';
import type {Group} from '@mattermost/types/groups';
import {getGroupsNotAssociatedToChannel, linkGroupSyncable, getAllGroupsAssociatedToChannel, getAllGroupsAssociatedToTeam} from 'mattermost-redux/actions/groups'; import {getGroupsNotAssociatedToChannel, linkGroupSyncable, getAllGroupsAssociatedToChannel, getAllGroupsAssociatedToTeam} from 'mattermost-redux/actions/groups';
import {getTeam} from 'mattermost-redux/actions/teams'; import {getTeam} from 'mattermost-redux/actions/teams';
import {getGroupsNotAssociatedToChannel as selectGroupsNotAssociatedToChannel} from 'mattermost-redux/selectors/entities/groups';
import {getCurrentChannel} from 'mattermost-redux/selectors/entities/channels'; import {getCurrentChannel} from 'mattermost-redux/selectors/entities/channels';
import {getGroupsNotAssociatedToChannel as selectGroupsNotAssociatedToChannel} from 'mattermost-redux/selectors/entities/groups';
import type {ActionFunc, GenericAction} from 'mattermost-redux/types/actions';
import {Channel} from '@mattermost/types/channels';
import {ActionFunc, GenericAction} from 'mattermost-redux/types/actions';
import {Group} from '@mattermost/types/groups';
import {GlobalState} from 'types/store';
import {setModalSearchTerm} from 'actions/views/search'; import {setModalSearchTerm} from 'actions/views/search';
import AddGroupsToChannelModal, {Props} from './add_groups_to_channel_modal'; import type {GlobalState} from 'types/store';
import AddGroupsToChannelModal from './add_groups_to_channel_modal';
import type {Props} from './add_groups_to_channel_modal';
type OwnProps = { type OwnProps = {
channel: Channel; channel: Channel;

View File

@ -1,8 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import {SyncableType} from '@mattermost/types/groups'; import {SyncableType} from '@mattermost/types/groups';

View File

@ -1,20 +1,23 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React, {RefObject} from 'react'; import React from 'react';
import type {RefObject} from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {Group, GroupsWithCount, SyncablePatch, SyncableType} from '@mattermost/types/groups'; import type {Group, GroupsWithCount, SyncablePatch} from '@mattermost/types/groups';
import {SyncableType} from '@mattermost/types/groups';
import Nbsp from 'components/html_entities/nbsp';
import MultiSelect from 'components/multiselect/multiselect';
import type {Value} from 'components/multiselect/multiselect';
import AddIcon from 'components/widgets/icons/fa_add_icon';
import groupsAvatar from 'images/groups-avatar.png';
import Constants from 'utils/constants'; import Constants from 'utils/constants';
import {localizeMessage} from 'utils/utils'; import {localizeMessage} from 'utils/utils';
import MultiSelect, {Value} from 'components/multiselect/multiselect';
import groupsAvatar from 'images/groups-avatar.png';
import AddIcon from 'components/widgets/icons/fa_add_icon';
import Nbsp from 'components/html_entities/nbsp';
const GROUPS_PER_PAGE = 50; const GROUPS_PER_PAGE = 50;
const MAX_SELECTABLE_VALUES = 10; const MAX_SELECTABLE_VALUES = 10;

View File

@ -2,19 +2,23 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import type {Group} from '@mattermost/types/groups';
import type {Team} from '@mattermost/types/teams';
import {getGroupsNotAssociatedToTeam, linkGroupSyncable, getAllGroupsAssociatedToTeam} from 'mattermost-redux/actions/groups'; import {getGroupsNotAssociatedToTeam, linkGroupSyncable, getAllGroupsAssociatedToTeam} from 'mattermost-redux/actions/groups';
import {getGroupsNotAssociatedToTeam as selectGroupsNotAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups'; import {getGroupsNotAssociatedToTeam as selectGroupsNotAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups';
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
import {Team} from '@mattermost/types/teams'; import type {ActionFunc, GenericAction} from 'mattermost-redux/types/actions';
import {Group} from '@mattermost/types/groups';
import {ActionFunc, GenericAction} from 'mattermost-redux/types/actions';
import {setModalSearchTerm} from 'actions/views/search'; import {setModalSearchTerm} from 'actions/views/search';
import {GlobalState} from '../../types/store';
import AddGroupsToTeamModal, {Actions} from './add_groups_to_team_modal'; import type {GlobalState} from 'types/store';
import AddGroupsToTeamModal from './add_groups_to_team_modal';
import type {Actions} from './add_groups_to_team_modal';
type Props = { type Props = {
team?: Team; team?: Team;

View File

@ -1,10 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import AddUserToChannelModal from 'components/add_user_to_channel_modal/add_user_to_channel_modal'; import AddUserToChannelModal from 'components/add_user_to_channel_modal/add_user_to_channel_modal';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';
describe('components/AddUserToChannelModal', () => { describe('components/AddUserToChannelModal', () => {

View File

@ -1,24 +1,25 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React, {ChangeEvent, FormEvent} from 'react'; import React from 'react';
import type {ChangeEvent, FormEvent} from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {getFullName} from 'mattermost-redux/utils/user_utils'; import type {Channel, ChannelMembership} from '@mattermost/types/channels';
import {ActionResult} from 'mattermost-redux/types/actions'; import type {UserProfile} from '@mattermost/types/users';
import type {RelationOneToOne} from '@mattermost/types/utilities';
import type {ActionResult} from 'mattermost-redux/types/actions';
import {getFullName} from 'mattermost-redux/utils/user_utils';
import ModalSuggestionList from 'components/suggestion/modal_suggestion_list';
import SearchChannelWithPermissionsProvider from 'components/suggestion/search_channel_with_permissions_provider'; import SearchChannelWithPermissionsProvider from 'components/suggestion/search_channel_with_permissions_provider';
import SuggestionBox from 'components/suggestion/suggestion_box'; import SuggestionBox from 'components/suggestion/suggestion_box';
import SuggestionBoxComponent from 'components/suggestion/suggestion_box/suggestion_box'; import type SuggestionBoxComponent from 'components/suggestion/suggestion_box/suggestion_box';
import ModalSuggestionList from 'components/suggestion/modal_suggestion_list';
import {placeCaretAtEnd} from 'utils/utils'; import {placeCaretAtEnd} from 'utils/utils';
import {UserProfile} from '@mattermost/types/users';
import {Channel, ChannelMembership} from '@mattermost/types/channels';
import {RelationOneToOne} from '@mattermost/types/utilities';
export type Props = { export type Props = {
/** /**

View File

@ -2,16 +2,17 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import type {GlobalState} from '@mattermost/types/store';
import {addChannelMember, getChannelMember, autocompleteChannelsForSearch} from 'mattermost-redux/actions/channels'; import {addChannelMember, getChannelMember, autocompleteChannelsForSearch} from 'mattermost-redux/actions/channels';
import {getChannelMembersInChannels} from 'mattermost-redux/selectors/entities/channels'; import {getChannelMembersInChannels} from 'mattermost-redux/selectors/entities/channels';
import type {ActionFunc} from 'mattermost-redux/types/actions';
import {GlobalState} from '@mattermost/types/store'; import AddUserToChannelModal from './add_user_to_channel_modal';
import type {Props} from './add_user_to_channel_modal';
import {ActionFunc} from 'mattermost-redux/types/actions';
import AddUserToChannelModal, {Props} from './add_user_to_channel_modal';
function mapStateToProps(state: GlobalState) { function mapStateToProps(state: GlobalState) {
const channelMembers = getChannelMembersInChannels(state) || {}; const channelMembers = getChannelMembersInChannels(state) || {};

View File

@ -1,14 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {shallow} from 'enzyme';
import React from 'react'; import React from 'react';
import {shallow} from 'enzyme'; import type {UserProfile} from '@mattermost/types/users';
import type {RelationOneToOne} from '@mattermost/types/utilities';
import {UserProfile} from '@mattermost/types/users'; import type {Value} from 'components/multiselect/multiselect';
import {Value} from 'components/multiselect/multiselect';
import {RelationOneToOne} from '@mattermost/types/utilities';
import AddUserToGroupMultiSelect from './add_user_to_group_multiselect'; import AddUserToGroupMultiSelect from './add_user_to_group_multiselect';

View File

@ -3,15 +3,17 @@
import React from 'react'; import React from 'react';
import {RelationOneToOne} from '@mattermost/types/utilities'; import type {UserProfile} from '@mattermost/types/users';
import {ActionResult} from 'mattermost-redux/types/actions'; import type {RelationOneToOne} from '@mattermost/types/utilities';
import {UserProfile} from '@mattermost/types/users';
import type {ActionResult} from 'mattermost-redux/types/actions';
import {filterProfilesStartingWithTerm} from 'mattermost-redux/utils/user_utils'; import {filterProfilesStartingWithTerm} from 'mattermost-redux/utils/user_utils';
import {localizeMessage} from 'utils/utils';
import MultiSelect, {Value} from 'components/multiselect/multiselect'; import MultiSelect from 'components/multiselect/multiselect';
import type {Value} from 'components/multiselect/multiselect';
import Constants from 'utils/constants'; import Constants from 'utils/constants';
import {localizeMessage} from 'utils/utils';
import MultiSelectOption from './multiselect_option/multiselect_option'; import MultiSelectOption from './multiselect_option/multiselect_option';

View File

@ -2,18 +2,20 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import type {UserProfile} from '@mattermost/types/users';
import {getProfilesNotInGroup, searchProfiles, getProfiles} from 'mattermost-redux/actions/users'; import {getProfilesNotInGroup, searchProfiles, getProfiles} from 'mattermost-redux/actions/users';
import {getProfilesNotInCurrentGroup, getUserStatuses, getProfiles as getUsers} from 'mattermost-redux/selectors/entities/users'; import {getProfilesNotInCurrentGroup, getUserStatuses, getProfiles as getUsers} from 'mattermost-redux/selectors/entities/users';
import {Action, ActionResult} from 'mattermost-redux/types/actions'; import type {Action, ActionResult} from 'mattermost-redux/types/actions';
import {UserProfile} from '@mattermost/types/users';
import {Value} from 'components/multiselect/multiselect';
import {loadStatusesForProfilesList} from 'actions/status_actions'; import {loadStatusesForProfilesList} from 'actions/status_actions';
import {GlobalState} from 'types/store'; import type {Value} from 'components/multiselect/multiselect';
import type {GlobalState} from 'types/store';
import AddUserToGroupMultiSelect from './add_user_to_group_multiselect'; import AddUserToGroupMultiSelect from './add_user_to_group_multiselect';

View File

@ -1,22 +1,22 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import React from 'react';
import GuestTag from 'components/widgets/tag/guest_tag'; import type {UserProfile} from '@mattermost/types/users';
import BotTag from 'components/widgets/tag/bot_tag'; import type {RelationOneToOne} from '@mattermost/types/utilities';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {UserProfile} from '@mattermost/types/users';
import {RelationOneToOne} from '@mattermost/types/utilities';
import {isGuest} from 'mattermost-redux/utils/user_utils'; import {isGuest} from 'mattermost-redux/utils/user_utils';
import {displayEntireNameForUser} from 'utils/utils';
import type {Value} from 'components/multiselect/multiselect';
import ProfilePicture from 'components/profile_picture'; import ProfilePicture from 'components/profile_picture';
import AddIcon from 'components/widgets/icons/fa_add_icon'; import AddIcon from 'components/widgets/icons/fa_add_icon';
import BotTag from 'components/widgets/tag/bot_tag';
import GuestTag from 'components/widgets/tag/guest_tag';
import {Value} from 'components/multiselect/multiselect'; import {displayEntireNameForUser} from 'utils/utils';
type UserProfileValue = Value & UserProfile; type UserProfileValue = Value & UserProfile;

View File

@ -1,9 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import AddUsersToGroupModal from './add_users_to_group_modal'; import AddUsersToGroupModal from './add_users_to_group_modal';

View File

@ -2,23 +2,23 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React, {useState, useCallback, useMemo} from 'react'; import React, {useState, useCallback, useMemo} from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {UserProfile} from '@mattermost/types/users'; import type {Group} from '@mattermost/types/groups';
import type {UserProfile} from '@mattermost/types/users';
import type {ActionResult} from 'mattermost-redux/types/actions';
import AddUserToGroupMultiSelect from 'components/add_user_to_group_multiselect';
import LocalizedIcon from 'components/localized_icon';
import {t} from 'utils/i18n';
import {localizeMessage} from 'utils/utils'; import {localizeMessage} from 'utils/utils';
import {Group} from '@mattermost/types/groups';
import type {ModalData} from 'types/actions';
import 'components/user_groups_modal/user_groups_modal.scss'; import 'components/user_groups_modal/user_groups_modal.scss';
import {ModalData} from 'types/actions';
import AddUserToGroupMultiSelect from 'components/add_user_to_group_multiselect';
import {ActionResult} from 'mattermost-redux/types/actions';
import LocalizedIcon from 'components/localized_icon';
import {t} from 'utils/i18n';
export type Props = { export type Props = {
onExited: () => void; onExited: () => void;

View File

@ -2,17 +2,18 @@
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux'; import {bindActionCreators} from 'redux';
import type {ActionCreatorsMapObject, Dispatch} from 'redux';
import {Action, ActionResult} from 'mattermost-redux/types/actions';
import {GlobalState} from 'types/store';
import {addUsersToGroup} from 'mattermost-redux/actions/groups'; import {addUsersToGroup} from 'mattermost-redux/actions/groups';
import {getGroup} from 'mattermost-redux/selectors/entities/groups'; import {getGroup} from 'mattermost-redux/selectors/entities/groups';
import {ModalData} from 'types/actions'; import type {Action, ActionResult} from 'mattermost-redux/types/actions';
import {openModal} from 'actions/views/modals'; import {openModal} from 'actions/views/modals';
import type {ModalData} from 'types/actions';
import type {GlobalState} from 'types/store';
import AddUsersToGroupModal from './add_users_to_group_modal'; import AddUsersToGroupModal from './add_users_to_group_modal';
type Actions = { type Actions = {

View File

@ -1,11 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme'; import {shallow} from 'enzyme';
import React from 'react';
import {UserProfile} from '@mattermost/types/users'; import type {Team} from '@mattermost/types/teams';
import {Team} from '@mattermost/types/teams'; import type {UserProfile} from '@mattermost/types/users';
import {TestHelper} from 'utils/test_helper'; import {TestHelper} from 'utils/test_helper';

View File

@ -5,20 +5,20 @@ import React from 'react';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import GuestTag from 'components/widgets/tag/guest_tag'; import type {Team} from '@mattermost/types/teams';
import BotTag from 'components/widgets/tag/bot_tag'; import type {UserProfile} from '@mattermost/types/users';
import {UserProfile} from '@mattermost/types/users';
import {Team} from '@mattermost/types/teams';
import {Client4} from 'mattermost-redux/client'; import {Client4} from 'mattermost-redux/client';
import {isGuest} from 'mattermost-redux/utils/user_utils';
import MultiSelect from 'components/multiselect/multiselect';
import type {Value} from 'components/multiselect/multiselect';
import ProfilePicture from 'components/profile_picture';
import AddIcon from 'components/widgets/icons/fa_add_icon';
import BotTag from 'components/widgets/tag/bot_tag';
import GuestTag from 'components/widgets/tag/guest_tag';
import {displayEntireNameForUser, localizeMessage} from 'utils/utils'; import {displayEntireNameForUser, localizeMessage} from 'utils/utils';
import {isGuest} from 'mattermost-redux/utils/user_utils';
import ProfilePicture from 'components/profile_picture';
import MultiSelect, {Value} from 'components/multiselect/multiselect';
import AddIcon from 'components/widgets/icons/fa_add_icon';
const USERS_PER_PAGE = 50; const USERS_PER_PAGE = 50;
const MAX_SELECTABLE_VALUES = 20; const MAX_SELECTABLE_VALUES = 20;

Some files were not shown because too many files have changed in this diff Show More