闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.0 KiB

  1. import { SETTING_CHANGE } from '../actions/settings';
  2. import { STORE_HYDRATE } from '../actions/store';
  3. import Immutable from 'immutable';
  4. const initialState = Immutable.Map({
  5. onboarded: false,
  6. home: Immutable.Map({
  7. shows: Immutable.Map({
  8. reblog: true,
  9. reply: true,
  10. }),
  11. regex: Immutable.Map({
  12. body: '',
  13. }),
  14. }),
  15. notifications: Immutable.Map({
  16. alerts: Immutable.Map({
  17. follow: true,
  18. favourite: true,
  19. reblog: true,
  20. mention: true,
  21. }),
  22. shows: Immutable.Map({
  23. follow: true,
  24. favourite: true,
  25. reblog: true,
  26. mention: true,
  27. }),
  28. sounds: Immutable.Map({
  29. follow: true,
  30. favourite: true,
  31. reblog: true,
  32. mention: true,
  33. }),
  34. }),
  35. });
  36. export default function settings(state = initialState, action) {
  37. switch(action.type) {
  38. case STORE_HYDRATE:
  39. return state.mergeDeep(action.state.get('settings'));
  40. case SETTING_CHANGE:
  41. return state.setIn(action.key, action.value);
  42. default:
  43. return state;
  44. }
  45. };