Improve Redux types part 5/Replace DispatchFunc (#26004)
* Remove non-functional code from Login component * Remove remaining usage of useDispatch<DispatchFunc> * Remove usage of DispatchFunc from actions/file_actions * actions/global_actions * Remove usage of DispatchFunc from actions/marketplace * Remove DispatchFunc from actions/post_actions * Remove DispatchFunc from actions/storage * Remove DispatchFunc from actions/user_actions * Remove DispatchFunc from actions/views/channel * Remove DispatchFunc from actions/views/channel_sidebar * Remove DispatchFunc from actions/views/create_comment * Remove DispatchFunc from actions/views/lhs.ts * Remove DispatchFunc from actions/views/rhs.ts * Remove DispatchFunc from actions/views/onboarding_tasks * Remove DispatchFunc from actions/views/root * Remove DispatchFunc from components/logged_in * Remove DispatchFunc from components/msg_typing * Remove DispatchFunc from components/permalink_view * Remove DispatchFunc from components/suggestion * Remove DispatchFunc from mattermost-redux/actions/posts * Remove DispatchFunc from mattermost-redux/actions/roles * Remove DispatchFunc from mattermost-redux/actions/threads * Remove DispatchFunc from mattermost-redux/actions/timezone * Remove DispatchFunc from plugins/products * Make DispatchFunc into Dispatch * Fix how dispatch is mocked in test for toggleSideBarRightMenuAction
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d8e11fe292
Коммит
8e165c7685
@@ -14,7 +14,6 @@ import {
|
||||
getCloudCustomer as selectCloudCustomer,
|
||||
getCloudErrors,
|
||||
} from 'mattermost-redux/selectors/entities/cloud';
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {pageVisited} from 'actions/telemetry_actions';
|
||||
|
||||
@@ -58,7 +57,7 @@ export const searchableStrings = [
|
||||
];
|
||||
|
||||
const BillingSubscriptions = () => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
const subscription = useSelector(selectCloudSubscription);
|
||||
const [cloudLimits] = useGetLimits();
|
||||
const errorLoadingData = useSelector((state: GlobalState) => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import {useDispatch, useSelector} from 'react-redux';
|
||||
|
||||
import {getCloudCustomer} from 'mattermost-redux/actions/cloud';
|
||||
import {getCloudErrors} from 'mattermost-redux/selectors/entities/cloud';
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {pageVisited} from 'actions/telemetry_actions';
|
||||
|
||||
@@ -27,7 +26,7 @@ export const searchableStrings = [
|
||||
];
|
||||
|
||||
const CompanyInfo: React.FC<Props> = () => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
const {customer: customerError} = useSelector(getCloudErrors);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -10,7 +10,6 @@ import type {Feedback} from '@mattermost/types/cloud';
|
||||
|
||||
import {getSubscriptionProduct} from 'mattermost-redux/selectors/entities/cloud';
|
||||
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {subscribeCloudSubscription, deleteWorkspace as deleteWorkspaceRequest} from 'actions/cloud';
|
||||
import {closeModal, openModal} from 'actions/views/modals';
|
||||
@@ -45,7 +44,7 @@ export const messages = defineMessages({
|
||||
});
|
||||
|
||||
export default function DeleteWorkspaceModal(props: Props) {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
const openDowngradeModal = useOpenDowngradeModal();
|
||||
|
||||
// License/product checks.
|
||||
|
||||
@@ -9,7 +9,6 @@ import type {GlobalState} from '@mattermost/types/store';
|
||||
|
||||
import {getCloudCustomer} from 'mattermost-redux/actions/cloud';
|
||||
import {getCloudErrors} from 'mattermost-redux/selectors/entities/cloud';
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {pageVisited} from 'actions/telemetry_actions';
|
||||
|
||||
@@ -32,7 +31,7 @@ export const searchableStrings = [
|
||||
];
|
||||
|
||||
const PaymentInfo: React.FC<Props> = () => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
const {customer: customerError} = useSelector(getCloudErrors);
|
||||
|
||||
const isCardAboutToExpire = useSelector((state: GlobalState) => {
|
||||
|
||||
@@ -8,8 +8,6 @@ import {useDispatch} from 'react-redux';
|
||||
import {AlertOutlineIcon} from '@mattermost/compass-icons/components';
|
||||
import type {AllowedIPRange, FetchIPResponse} from '@mattermost/types/config';
|
||||
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {applyIPFilters, getCurrentIP, getIPFilters} from 'actions/admin_actions';
|
||||
import {getInstallation} from 'actions/cloud';
|
||||
import {closeModal, openModal} from 'actions/views/modals';
|
||||
@@ -30,7 +28,7 @@ import SaveChangesPanel from '../team_channel_settings/save_changes_panel';
|
||||
import './ip_filtering.scss';
|
||||
|
||||
const IPFiltering = () => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
const {formatMessage} = useIntl();
|
||||
const [ipFilters, setIpFilters] = useState<AllowedIPRange[] | null>(null);
|
||||
const [originalIpFilters, setOriginalIpFilters] = useState<AllowedIPRange[] | null>(null);
|
||||
|
||||
@@ -7,8 +7,6 @@ import {useSelector, useDispatch} from 'react-redux';
|
||||
|
||||
import {GenericModal} from '@mattermost/components';
|
||||
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {closeModal} from 'actions/views/modals';
|
||||
import {isModalOpen} from 'selectors/views/modals';
|
||||
|
||||
@@ -27,7 +25,7 @@ type Props = {
|
||||
}
|
||||
|
||||
const ConfirmLicenseRemovalModal: React.FC<Props> = (props: Props): JSX.Element | null => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const show = useSelector((state: GlobalState) => isModalOpen(state, ModalIdentifiers.CONFIRM_LICENSE_REMOVAL));
|
||||
if (!show) {
|
||||
|
||||
@@ -6,8 +6,6 @@ import {useSelector, useDispatch} from 'react-redux';
|
||||
|
||||
import {GenericModal} from '@mattermost/components';
|
||||
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {closeModal} from 'actions/views/modals';
|
||||
import {isModalOpen} from 'selectors/views/modals';
|
||||
|
||||
@@ -22,7 +20,7 @@ type Props = {
|
||||
}
|
||||
|
||||
const EELicenseModal: React.FC<Props> = (props: Props): JSX.Element | null => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const show = useSelector((state: GlobalState) => isModalOpen(state, ModalIdentifiers.ENTERPRISE_EDITION_LICENSE));
|
||||
if (!show) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import type {ClientLicense} from '@mattermost/types/config';
|
||||
import {uploadLicense} from 'mattermost-redux/actions/admin';
|
||||
import {getLicenseConfig} from 'mattermost-redux/actions/general';
|
||||
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||
import type {DispatchFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import {closeModal} from 'actions/views/modals';
|
||||
import {getCurrentLocale} from 'selectors/i18n';
|
||||
@@ -38,7 +37,7 @@ type Props = {
|
||||
}
|
||||
|
||||
const UploadLicenseModal = (props: Props): JSX.Element | null => {
|
||||
const dispatch = useDispatch<DispatchFunc>();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [fileObj, setFileObj] = React.useState<File | null>(props.fileObjFromProps);
|
||||
const [isUploading, setIsUploading] = React.useState(false);
|
||||
|
||||
@@ -42,12 +42,8 @@ export interface Props {
|
||||
enableGuestAccounts: boolean;
|
||||
filters: Filters;
|
||||
actions: {
|
||||
loadTeamMembersForProfilesList: (profiles: UserProfile[], teamId: string) => Promise<{
|
||||
data: boolean;
|
||||
}>;
|
||||
loadChannelMembersForProfilesList: (profiles: UserProfile[], channelId: string) => Promise<{
|
||||
data: boolean;
|
||||
}>;
|
||||
loadTeamMembersForProfilesList: (profiles: UserProfile[], teamId: string) => Promise<ActionResult>;
|
||||
loadChannelMembersForProfilesList: (profiles: UserProfile[], channelId: string) => Promise<ActionResult>;
|
||||
setModalSearchTerm: (term: string) => ActionResult;
|
||||
setModalFilters: (filters: Filters) => ActionResult;
|
||||
};
|
||||
|
||||
Ссылка в новой задаче
Block a user