[Glitch] Convert disconnectTimeline and timelineDelete actions to Typescript

Port 1c65932776 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput
2024-06-20 13:56:52 +02:00
committed by Claire
parent fd867adffe
commit 8ae61fdee5
10 changed files with 63 additions and 47 deletions

View File

@@ -1,5 +1,7 @@
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
import { timelineDelete } from 'flavours/glitch/actions/timelines_typed';
import {
COMPOSE_MOUNT,
COMPOSE_UNMOUNT,
@@ -54,7 +56,6 @@ import {
} from '../actions/compose';
import { REDRAFT } from '../actions/statuses';
import { STORE_HYDRATE } from '../actions/store';
import { TIMELINE_DELETE } from '../actions/timelines';
import { me, defaultContentType } from '../initial_state';
import { recoverHashtags } from '../utils/hashtag';
import { unescapeHTML } from '../utils/html';
@@ -551,10 +552,10 @@ export default function compose(state = initialState, action) {
return updateSuggestionTags(state, action.token);
case COMPOSE_TAG_HISTORY_UPDATE:
return state.set('tagHistory', fromJS(action.tags));
case TIMELINE_DELETE:
if (action.id === state.get('in_reply_to')) {
case timelineDelete.type:
if (action.payload.statusId === state.get('in_reply_to')) {
return state.set('in_reply_to', null);
} else if (action.id === state.get('id')) {
} else if (action.payload.statusId === state.get('id')) {
return state.set('id', null);
} else {
return state;