* Fix EmojiFormatter failure * Add notification_emails.warning setting default value * Fix list spec failure and add antennas for spec response * Fix domain block spec failure to add kb custom response * Fix SearchQueryTransformer spec failure * Fix Account#matches_display_name spec failure * Fix UpdateStatusService changes mentions spec failure * Fix RuboCop Lint * Ignore brakeman warning * Fix CI failure for ignore brakeman warning * Fix migration failure * Fix README * Fix migration CI failure * Fix some spec failure * Format code for RuboCop lint failure * Fix ESlint failure * Fix haml-lint failure
37 lines
1 KiB
JavaScript
37 lines
1 KiB
JavaScript
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
|
|
|
import {
|
|
ANTENNA_ACCOUNTS_FETCH_REQUEST,
|
|
ANTENNA_ACCOUNTS_FETCH_SUCCESS,
|
|
ANTENNA_ACCOUNTS_FETCH_FAIL,
|
|
} from '../actions/antennas';
|
|
|
|
const initialState = ImmutableMap({
|
|
antennaId: null,
|
|
isSubmitting: false,
|
|
isChanged: false,
|
|
title: '',
|
|
|
|
accounts: ImmutableMap({
|
|
items: ImmutableList(),
|
|
loaded: false,
|
|
isLoading: false,
|
|
}),
|
|
});
|
|
|
|
export default function antennaEditorReducer(state = initialState, action) {
|
|
switch(action.type) {
|
|
case ANTENNA_ACCOUNTS_FETCH_REQUEST:
|
|
return state.setIn(['accounts', 'isLoading'], true);
|
|
case ANTENNA_ACCOUNTS_FETCH_FAIL:
|
|
return state.setIn(['accounts', 'isLoading'], false);
|
|
case ANTENNA_ACCOUNTS_FETCH_SUCCESS:
|
|
return state.update('accounts', accounts => accounts.withMutations(map => {
|
|
map.set('isLoading', false);
|
|
map.set('loaded', true);
|
|
map.set('items', ImmutableList(action.accounts.map(item => item.id)));
|
|
}));
|
|
default:
|
|
return state;
|
|
}
|
|
}
|