From d32e0364f9aa2d61080c53489996351d4bd7b1c4 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 21 Nov 2016 10:52:11 +0100
Subject: Switch to compose route when replying and compose is not mounted

---
 app/assets/javascripts/components/reducers/compose.jsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'app/assets/javascripts/components/reducers/compose.jsx')

diff --git a/app/assets/javascripts/components/reducers/compose.jsx b/app/assets/javascripts/components/reducers/compose.jsx
index 3adff36a3..e6e86d4f5 100644
--- a/app/assets/javascripts/components/reducers/compose.jsx
+++ b/app/assets/javascripts/components/reducers/compose.jsx
@@ -1,4 +1,6 @@
 import {
+  COMPOSE_MOUNT,
+  COMPOSE_UNMOUNT,
   COMPOSE_CHANGE,
   COMPOSE_REPLY,
   COMPOSE_REPLY_CANCEL,
@@ -20,6 +22,7 @@ import { ACCOUNT_SET_SELF } from '../actions/accounts';
 import Immutable from 'immutable';
 
 const initialState = Immutable.Map({
+  mounted: false,
   text: '',
   in_reply_to: null,
   is_submitting: false,
@@ -80,6 +83,10 @@ const insertSuggestion = (state, position, completion) => {
 
 export default function compose(state = initialState, action) {
   switch(action.type) {
+    case COMPOSE_MOUNT:
+      return state.set('mounted', true);
+    case COMPOSE_UNMOUNT:
+      return state.set('mounted', false);
     case COMPOSE_CHANGE:
       return state.set('text', action.text);
     case COMPOSE_REPLY:
-- 
cgit 

