0
0
Fork 0

Convert disconnectTimeline and timelineDelete actions to Typescript (#30777)

This commit is contained in:
Renaud Chaput 2024-06-20 13:56:52 +02:00 committed by GitHub
parent 27529247b2
commit 1c65932776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 65 additions and 49 deletions

View file

@ -1,10 +1,11 @@
import type { Reducer } from '@reduxjs/toolkit';
import { Record as ImmutableRecord, Stack } from 'immutable';
import { timelineDelete } from 'mastodon/actions/timelines_typed';
import { COMPOSE_UPLOAD_CHANGE_SUCCESS } from '../actions/compose';
import type { ModalType } from '../actions/modal';
import { openModal, closeModal } from '../actions/modal';
import { TIMELINE_DELETE } from '../actions/timelines';
export type ModalProps = Record<string, unknown>;
interface Modal {
@ -72,10 +73,10 @@ export const modalReducer: Reducer<State> = (state = initialState, action) => {
// TODO: type those actions
else if (action.type === COMPOSE_UPLOAD_CHANGE_SUCCESS)
return popModal(state, { modalType: 'FOCAL_POINT', ignoreFocus: false });
else if (action.type === TIMELINE_DELETE)
else if (timelineDelete.match(action))
return state.update('stack', (stack) =>
stack.filterNot(
(modal) => modal.get('modalProps').statusId === action.id,
(modal) => modal.get('modalProps').statusId === action.payload.statusId,
),
);
else return state;