Break out a separate mute modal with a hide-notifications checkbox.

This commit is contained in:
Surinna Curtis
2017-08-06 19:36:04 -03:00
parent 0c547faf92
commit 4612f7caea
9 changed files with 168 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ import local_settings from '../../glitch/reducers/local_settings';
import push_notifications from './push_notifications';
import status_lists from './status_lists';
import cards from './cards';
import mutes from './mutes';
import reports from './reports';
import contexts from './contexts';
import compose from './compose';
@@ -37,6 +38,7 @@ const reducers = {
local_settings,
push_notifications,
cards,
mutes,
reports,
contexts,
compose,

View File

@@ -0,0 +1,29 @@
import Immutable from 'immutable';
import {
MUTES_INIT_MODAL,
MUTES_TOGGLE_HIDE_NOTIFICATIONS,
} from '../actions/mutes';
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.setIn(['new', 'notifications'], !state.getIn(['new', 'notifications']));
default:
return state;
}
}