about summary refs log tree commit diff
path: root/app/assets/javascripts/components/reducers/compose.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/reducers/compose.jsx')
-rw-r--r--app/assets/javascripts/components/reducers/compose.jsx36
1 files changed, 24 insertions, 12 deletions
diff --git a/app/assets/javascripts/components/reducers/compose.jsx b/app/assets/javascripts/components/reducers/compose.jsx
index c0d9f4ff2..688c494c0 100644
--- a/app/assets/javascripts/components/reducers/compose.jsx
+++ b/app/assets/javascripts/components/reducers/compose.jsx
@@ -1,4 +1,16 @@
-import * as constants      from '../actions/compose';
+import {
+  COMPOSE_CHANGE,
+  COMPOSE_REPLY,
+  COMPOSE_REPLY_CANCEL,
+  COMPOSE_SUBMIT_REQUEST,
+  COMPOSE_SUBMIT_SUCCESS,
+  COMPOSE_SUBMIT_FAIL,
+  COMPOSE_UPLOAD_REQUEST,
+  COMPOSE_UPLOAD_SUCCESS,
+  COMPOSE_UPLOAD_FAIL,
+  COMPOSE_UPLOAD_UNDO,
+  COMPOSE_UPLOAD_PROGRESS
+}                          from '../actions/compose';
 import { TIMELINE_DELETE } from '../actions/timelines';
 import Immutable           from 'immutable';
 
@@ -13,41 +25,41 @@ const initialState = Immutable.Map({
 
 export default function compose(state = initialState, action) {
   switch(action.type) {
-    case constants.COMPOSE_CHANGE:
+    case COMPOSE_CHANGE:
       return state.set('text', action.text);
-    case constants.COMPOSE_REPLY:
+    case COMPOSE_REPLY:
       return state.withMutations(map => {
         map.set('in_reply_to', action.status.get('id'));
         map.set('text', `@${action.status.getIn(['account', 'acct'])} `);
       });
-    case constants.COMPOSE_REPLY_CANCEL:
+    case COMPOSE_REPLY_CANCEL:
       return state.withMutations(map => {
         map.set('in_reply_to', null);
         map.set('text', '');
       });
-    case constants.COMPOSE_SUBMIT_REQUEST:
+    case COMPOSE_SUBMIT_REQUEST:
       return state.set('is_submitting', true);
-    case constants.COMPOSE_SUBMIT_SUCCESS:
+    case COMPOSE_SUBMIT_SUCCESS:
       return state.withMutations(map => {
         map.set('text', '');
         map.set('is_submitting', false);
         map.set('in_reply_to', null);
         map.update('media_attachments', list => list.clear());
       });
-    case constants.COMPOSE_SUBMIT_FAIL:
+    case COMPOSE_SUBMIT_FAIL:
       return state.set('is_submitting', false);
-    case constants.COMPOSE_UPLOAD_REQUEST:
+    case COMPOSE_UPLOAD_REQUEST:
       return state.set('is_uploading', true);
-    case constants.COMPOSE_UPLOAD_SUCCESS:
+    case COMPOSE_UPLOAD_SUCCESS:
       return state.withMutations(map => {
         map.update('media_attachments', list => list.push(Immutable.fromJS(action.media)));
         map.set('is_uploading', false);
       });
-    case constants.COMPOSE_UPLOAD_FAIL:
+    case COMPOSE_UPLOAD_FAIL:
       return state.set('is_uploading', false);
-    case constants.COMPOSE_UPLOAD_UNDO:
+    case COMPOSE_UPLOAD_UNDO:
       return state.update('media_attachments', list => list.filterNot(item => item.get('id') === action.media_id));
-    case constants.COMPOSE_UPLOAD_PROGRESS:
+    case COMPOSE_UPLOAD_PROGRESS:
       return state.set('progress', Math.round((action.loaded / action.total) * 100));
     case TIMELINE_DELETE:
       if (action.id === state.get('in_reply_to')) {