Make compose form also use normalized data
This commit is contained in:
parent
926eea89b5
commit
05001d54d1
3 changed files with 27 additions and 6 deletions
|
@ -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)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue