logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

mutes.js (732B)


  1. import Immutable from 'immutable';
  2. import {
  3. MUTES_INIT_MODAL,
  4. MUTES_TOGGLE_HIDE_NOTIFICATIONS,
  5. } from '../actions/mutes';
  6. const initialState = Immutable.Map({
  7. new: Immutable.Map({
  8. isSubmitting: false,
  9. account: null,
  10. notifications: true,
  11. }),
  12. });
  13. export default function mutes(state = initialState, action) {
  14. switch (action.type) {
  15. case MUTES_INIT_MODAL:
  16. return state.withMutations((state) => {
  17. state.setIn(['new', 'isSubmitting'], false);
  18. state.setIn(['new', 'account'], action.account);
  19. state.setIn(['new', 'notifications'], true);
  20. });
  21. case MUTES_TOGGLE_HIDE_NOTIFICATIONS:
  22. return state.updateIn(['new', 'notifications'], (old) => !old);
  23. default:
  24. return state;
  25. }
  26. }