闭社主体 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.

48 lines
979 B

  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. }),
  12. notifications: Immutable.Map({
  13. alerts: Immutable.Map({
  14. follow: true,
  15. favourite: true,
  16. reblog: true,
  17. mention: true
  18. }),
  19. shows: Immutable.Map({
  20. follow: true,
  21. favourite: true,
  22. reblog: true,
  23. mention: true
  24. }),
  25. sounds: Immutable.Map({
  26. follow: true,
  27. favourite: true,
  28. reblog: true,
  29. mention: true
  30. })
  31. })
  32. });
  33. export default function settings(state = initialState, action) {
  34. switch(action.type) {
  35. case STORE_HYDRATE:
  36. return state.mergeDeep(action.state.get('settings'));
  37. case SETTING_CHANGE:
  38. return state.setIn(action.key, action.value);
  39. default:
  40. return state;
  41. }
  42. };