Refactor <HashtagHeader> to TypeScript (#33096)

This commit is contained in:
Eugen Rochko 2024-12-06 09:42:24 +01:00 committed by GitHub
parent a1143c522b
commit 25387dc423
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 238 additions and 237 deletions

View file

@ -36,7 +36,6 @@ import settings from './settings';
import status_lists from './status_lists';
import statuses from './statuses';
import { suggestionsReducer } from './suggestions';
import tags from './tags';
import timelines from './timelines';
import trends from './trends';
import user_lists from './user_lists';
@ -76,7 +75,6 @@ const reducers = {
markers: markersReducer,
picture_in_picture: pictureInPictureReducer,
history,
tags,
followed_tags,
notificationPolicy: notificationPolicyReducer,
notificationRequests: notificationRequestsReducer,

View file

@ -1,26 +0,0 @@
import { Map as ImmutableMap, fromJS } from 'immutable';
import {
HASHTAG_FETCH_SUCCESS,
HASHTAG_FOLLOW_REQUEST,
HASHTAG_FOLLOW_FAIL,
HASHTAG_UNFOLLOW_REQUEST,
HASHTAG_UNFOLLOW_FAIL,
} from 'mastodon/actions/tags';
const initialState = ImmutableMap();
export default function tags(state = initialState, action) {
switch(action.type) {
case HASHTAG_FETCH_SUCCESS:
return state.set(action.name, fromJS(action.tag));
case HASHTAG_FOLLOW_REQUEST:
case HASHTAG_UNFOLLOW_FAIL:
return state.setIn([action.name, 'following'], true);
case HASHTAG_FOLLOW_FAIL:
case HASHTAG_UNFOLLOW_REQUEST:
return state.setIn([action.name, 'following'], false);
default:
return state;
}
}