From 05001d54d15c486caa6cebe9462222d37d87576d Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 5 Sep 2016 16:56:43 +0200
Subject: Make compose form also use normalized data

---
 .../components/containers/compose_form_container.jsx      | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'app/assets/javascripts/components/containers/compose_form_container.jsx')

diff --git a/app/assets/javascripts/components/containers/compose_form_container.jsx b/app/assets/javascripts/components/containers/compose_form_container.jsx
index 534830c27..d49217a90 100644
--- a/app/assets/javascripts/components/containers/compose_form_container.jsx
+++ b/app/assets/javascripts/components/containers/compose_form_container.jsx
@@ -2,11 +2,24 @@ import { connect }                                          from 'react-redux';
 import ComposeForm                                          from '../components/compose_form';
 import { changeCompose, submitCompose, cancelReplyCompose } from '../actions/compose';
 
+function selectStatus(state) {
+  let statusId = state.getIn(['compose', 'in_reply_to'], null);
+
+  if (statusId === null) {
+    return null;
+  }
+
+  let status = state.getIn(['timelines', 'statuses', statusId]);
+  status = status.set('account', state.getIn(['timelines', 'accounts', status.get('account')]));
+
+  return status;
+};
+
 const mapStateToProps = function (state, props) {
   return {
     text: state.getIn(['compose', 'text']),
     is_submitting: state.getIn(['compose', 'is_submitting']),
-    in_reply_to: state.getIn(['compose', 'in_reply_to'])
+    in_reply_to: selectStatus(state)
   };
 };
 
-- 
cgit 

