diff --git a/app/soapbox/actions/compose.js b/app/soapbox/actions/compose.js index 6e3e0e7cb..20b0bf77c 100644 --- a/app/soapbox/actions/compose.js +++ b/app/soapbox/actions/compose.js @@ -98,7 +98,7 @@ export const ensureComposeIsVisible = (getState, routerHistory) => { } }; -export function setComposeToStatus(status, text, spoiler_text, content_type) { +export function setComposeToStatus(status, raw_text, spoiler_text, content_type) { return (dispatch, getState) => { const { instance } = getState(); const { explicitAddressing } = getFeatures(instance); @@ -106,7 +106,7 @@ export function setComposeToStatus(status, text, spoiler_text, content_type) { dispatch({ type: COMPOSE_SET_STATUS, status, - text, + raw_text, explicitAddressing, spoiler_text, content_type, diff --git a/app/soapbox/features/compose/components/privacy_dropdown.js b/app/soapbox/features/compose/components/privacy_dropdown.js index 23111ab1b..caf6ae6c6 100644 --- a/app/soapbox/features/compose/components/privacy_dropdown.js +++ b/app/soapbox/features/compose/components/privacy_dropdown.js @@ -34,6 +34,7 @@ class PrivacyDropdownMenu extends React.PureComponent { placement: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, + unavailable: PropTypes.bool, }; state = { @@ -244,9 +245,13 @@ class PrivacyDropdown extends React.PureComponent { } render() { - const { value, intl } = this.props; + const { value, intl, unavailable } = this.props; const { open, placement } = this.state; + if (unavailable) { + return null; + } + const valueOption = this.options.find(item => item.value === value); return ( diff --git a/app/soapbox/features/compose/components/schedule_button.js b/app/soapbox/features/compose/components/schedule_button.js index af2fb5598..484174355 100644 --- a/app/soapbox/features/compose/components/schedule_button.js +++ b/app/soapbox/features/compose/components/schedule_button.js @@ -16,6 +16,7 @@ class ScheduleButton extends React.PureComponent { static propTypes = { disabled: PropTypes.bool, active: PropTypes.bool, + unavailable: PropTypes.bool, onClick: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; @@ -25,7 +26,11 @@ class ScheduleButton extends React.PureComponent { } render() { - const { intl, active, disabled } = this.props; + const { intl, active, unavailable, disabled } = this.props; + + if (unavailable) { + return null; + } return ( { diff --git a/app/soapbox/features/compose/containers/privacy_dropdown_container.js b/app/soapbox/features/compose/containers/privacy_dropdown_container.js index 3cea17e9d..6f74a0293 100644 --- a/app/soapbox/features/compose/containers/privacy_dropdown_container.js +++ b/app/soapbox/features/compose/containers/privacy_dropdown_container.js @@ -8,6 +8,7 @@ import PrivacyDropdown from '../components/privacy_dropdown'; const mapStateToProps = state => ({ isModalOpen: Boolean(state.get('modals').size && state.get('modals').last().modalType === 'ACTIONS'), value: state.getIn(['compose', 'privacy']), + unavailable: !!state.getIn(['compose', 'id']), }); const mapDispatchToProps = dispatch => ({ diff --git a/app/soapbox/features/compose/containers/reply_indicator_container.js b/app/soapbox/features/compose/containers/reply_indicator_container.js index 1bcf243cc..19a80c7bb 100644 --- a/app/soapbox/features/compose/containers/reply_indicator_container.js +++ b/app/soapbox/features/compose/containers/reply_indicator_container.js @@ -8,13 +8,8 @@ const makeMapStateToProps = () => { const getStatus = makeGetStatus(); const mapStateToProps = state => { - let statusId = state.getIn(['compose', 'id'], null); - let editing = true; - - if (statusId === null) { - statusId = state.getIn(['compose', 'in_reply_to']); - editing = false; - } + const statusId = state.getIn(['compose', 'in_reply_to']); + const editing = !!state.getIn(['compose', 'id']); return { status: getStatus(state, { id: statusId }), diff --git a/app/soapbox/features/compose/containers/schedule_button_container.js b/app/soapbox/features/compose/containers/schedule_button_container.js index 6076220a4..3fce8b22d 100644 --- a/app/soapbox/features/compose/containers/schedule_button_container.js +++ b/app/soapbox/features/compose/containers/schedule_button_container.js @@ -5,6 +5,7 @@ import ScheduleButton from '../components/schedule_button'; const mapStateToProps = state => ({ active: state.getIn(['compose', 'schedule']) ? true : false, + unavailable: !!state.getIn(['compose', 'id']), }); const mapDispatchToProps = dispatch => ({