Add ability to follow hashtags in web UI (#18862)
This commit is contained in:
@ -39,6 +39,7 @@ import markers from './markers';
|
||||
import picture_in_picture from './picture_in_picture';
|
||||
import accounts_map from './accounts_map';
|
||||
import history from './history';
|
||||
import tags from './tags';
|
||||
|
||||
const reducers = {
|
||||
announcements,
|
||||
@ -81,6 +82,7 @@ const reducers = {
|
||||
markers,
|
||||
picture_in_picture,
|
||||
history,
|
||||
tags,
|
||||
};
|
||||
|
||||
export default combineReducers(reducers);
|
||||
|
25
app/javascript/mastodon/reducers/tags.js
Normal file
25
app/javascript/mastodon/reducers/tags.js
Normal file
@ -0,0 +1,25 @@
|
||||
import {
|
||||
HASHTAG_FETCH_SUCCESS,
|
||||
HASHTAG_FOLLOW_REQUEST,
|
||||
HASHTAG_FOLLOW_FAIL,
|
||||
HASHTAG_UNFOLLOW_REQUEST,
|
||||
HASHTAG_UNFOLLOW_FAIL,
|
||||
} from 'mastodon/actions/tags';
|
||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user