diff options
author | Surinna Curtis <ekiru.0@gmail.com> | 2017-08-06 19:36:04 -0300 |
---|---|---|
committer | Surinna Curtis <ekiru.0@gmail.com> | 2017-09-13 21:47:30 -0500 |
commit | 4612f7caea9086715c7c7405b03bf335f552860f (patch) | |
tree | 4988e75a4f8e46914d47ebc8f4c353c8fb75770b /app/javascript/mastodon/reducers | |
parent | 0c547faf92a5433bcf12811d76ece583c50beaf9 (diff) |
Break out a separate mute modal with a hide-notifications checkbox.
Diffstat (limited to 'app/javascript/mastodon/reducers')
-rw-r--r-- | app/javascript/mastodon/reducers/index.js | 2 | ||||
-rw-r--r-- | app/javascript/mastodon/reducers/mutes.js | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js index 86cda2adc..a54fca530 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.js @@ -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, diff --git a/app/javascript/mastodon/reducers/mutes.js b/app/javascript/mastodon/reducers/mutes.js new file mode 100644 index 000000000..6d6a9a3b8 --- /dev/null +++ b/app/javascript/mastodon/reducers/mutes.js @@ -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; + } +} \ No newline at end of file |