about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/lists.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-11-25 00:35:37 +0100
committerGitHub <noreply@github.com>2017-11-25 00:35:37 +0100
commit31ac5f0e00b003f060788d7a335f4ec33dd77d9a (patch)
tree9f26e03603eb5542a8a50de667f18da7dd7ad087 /app/javascript/mastodon/reducers/lists.js
parent269a445c0b24de37972cf35b26f9362c2b62122c (diff)
Display list column (#5750)
Diffstat (limited to 'app/javascript/mastodon/reducers/lists.js')
-rw-r--r--app/javascript/mastodon/reducers/lists.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/lists.js b/app/javascript/mastodon/reducers/lists.js
new file mode 100644
index 000000000..3e3908869
--- /dev/null
+++ b/app/javascript/mastodon/reducers/lists.js
@@ -0,0 +1,15 @@
+import { LIST_FETCH_SUCCESS } from '../actions/lists';
+import { Map as ImmutableMap, fromJS } from 'immutable';
+
+const initialState = ImmutableMap();
+
+const normalizeList = (state, list) => state.set(list.id, fromJS(list));
+
+export default function lists(state = initialState, action) {
+  switch(action.type) {
+  case LIST_FETCH_SUCCESS:
+    return normalizeList(state, action.list);
+  default:
+    return state;
+  }
+};