This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-11-14 18:56:41 -08:00
|
|
|
import Immutable from 'immutable';
|
|
|
|
|
|
|
|
import {
|
|
|
|
MUTES_INIT_MODAL,
|
|
|
|
MUTES_TOGGLE_HIDE_NOTIFICATIONS,
|
2017-12-03 23:26:40 -08:00
|
|
|
} from 'flavours/glitch/actions/mutes';
|
2017-11-14 18:56:41 -08:00
|
|
|
|
|
|
|
const initialState = Immutable.Map({
|
|
|
|
new: Immutable.Map({
|
|
|
|
isSubmitting: false,
|
|
|
|
account: null,
|
|
|
|
notifications: true,
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default function mutes(state = initialState, action) {
|
|
|
|
switch (action.type) {
|
|
|
|
case MUTES_INIT_MODAL:
|
|
|
|
return state.withMutations((state) => {
|
|
|
|
state.setIn(['new', 'isSubmitting'], false);
|
|
|
|
state.setIn(['new', 'account'], action.account);
|
|
|
|
state.setIn(['new', 'notifications'], true);
|
|
|
|
});
|
|
|
|
case MUTES_TOGGLE_HIDE_NOTIFICATIONS:
|
|
|
|
return state.updateIn(['new', 'notifications'], (old) => !old);
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|