]> cat aescling's git repositories - mastodon.git/blob - app/javascript/flavours/glitch/reducers/local_settings.js
Merge branch 'master' into glitch-soc/merge-upstream
[mastodon.git] / app / javascript / flavours / glitch / reducers / local_settings.js
1 // Package imports.
2 import { Map as ImmutableMap } from 'immutable';
3
4 // Our imports.
5 import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
6 import { LOCAL_SETTING_CHANGE } from 'flavours/glitch/actions/local_settings';
7
8 const initialState = ImmutableMap({
9 layout : 'auto',
10 stretch : true,
11 navbar_under : false,
12 side_arm : 'none',
13 side_arm_reply_mode : 'keep',
14 show_reply_count : false,
15 always_show_spoilers_field: false,
16 confirm_missing_media_description: false,
17 preselect_on_reply: true,
18 content_warnings : ImmutableMap({
19 auto_unfold : false,
20 filter : null,
21 }),
22 collapsed : ImmutableMap({
23 enabled : true,
24 auto : ImmutableMap({
25 all : false,
26 notifications : true,
27 lengthy : true,
28 reblogs : false,
29 replies : false,
30 media : false,
31 }),
32 backgrounds : ImmutableMap({
33 user_backgrounds : false,
34 preview_images : false,
35 }),
36 show_action_bar : true,
37 }),
38 media : ImmutableMap({
39 letterbox : true,
40 fullwidth : true,
41 }),
42 notifications : ImmutableMap({
43 favicon_badge : false,
44 tab_badge : true,
45 }),
46 });
47
48 const hydrate = (state, localSettings) => state.mergeDeep(localSettings);
49
50 export default function localSettings(state = initialState, action) {
51 switch(action.type) {
52 case STORE_HYDRATE:
53 return hydrate(state, action.state.get('local_settings'));
54 case LOCAL_SETTING_CHANGE:
55 return state.setIn(action.key, action.value);
56 default:
57 return state;
58 }
59 };
This page took 0.074133 seconds and 4 git commands to generate.