From 538d109a8268d639032e432ed6138ed57f35e5ef Mon Sep 17 00:00:00 2001 From: Anthony Bellew Date: Fri, 23 Dec 2016 07:20:16 -0700 Subject: [PATCH] Re-add unlisted toggle to the UI --- .../javascripts/components/actions/compose.jsx | 10 +++++++++- .../features/compose/components/compose_form.jsx | 14 +++++++++++++- .../compose/containers/compose_form_container.jsx | 8 +++++++- .../javascripts/components/reducers/compose.jsx | 6 +++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/components/actions/compose.jsx b/app/assets/javascripts/components/actions/compose.jsx index 9c9ec9ddec8..0e84723b608 100644 --- a/app/assets/javascripts/components/actions/compose.jsx +++ b/app/assets/javascripts/components/actions/compose.jsx @@ -24,6 +24,7 @@ export const COMPOSE_UNMOUNT = 'COMPOSE_UNMOUNT'; export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE'; export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE'; +export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE'; export function changeCompose(text) { return { @@ -67,7 +68,7 @@ export function submitCompose() { in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null), media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')), sensitive: getState().getIn(['compose', 'sensitive']), - visibility: getState().getIn(['compose', 'private']) ? 'private' : 'public' + visibility: getState().getIn(['compose', 'private']) ? 'private' : (getState().getIn(['compose', 'unlisted']) ? 'unlisted' : 'public') }).then(function (response) { dispatch(submitComposeSuccess({ ...response.data })); @@ -223,3 +224,10 @@ export function changeComposeVisibility(checked) { checked }; }; + +export function changeComposeListability(checked) { + return { + type: COMPOSE_LISTABILITY_CHANGE, + checked + }; +}; diff --git a/app/assets/javascripts/components/features/compose/components/compose_form.jsx b/app/assets/javascripts/components/features/compose/components/compose_form.jsx index 6a0e6778da9..1de3e068bac 100644 --- a/app/assets/javascripts/components/features/compose/components/compose_form.jsx +++ b/app/assets/javascripts/components/features/compose/components/compose_form.jsx @@ -34,7 +34,8 @@ const ComposeForm = React.createClass({ onFetchSuggestions: React.PropTypes.func.isRequired, onSuggestionSelected: React.PropTypes.func.isRequired, onChangeSensitivity: React.PropTypes.func.isRequired, - onChangeVisibility: React.PropTypes.func.isRequired + onChangeVisibility: React.PropTypes.func.isRequired, + onChangeListability: React.PropTypes.func.isRequired, }, mixins: [PureRenderMixin], @@ -73,6 +74,10 @@ const ComposeForm = React.createClass({ handleChangeVisibility (e) { this.props.onChangeVisibility(e.target.checked); }, + + handleChangeListability (e) { + this.props.onChangeListability(e.target.checked); + }, componentDidUpdate (prevProps) { if (prevProps.in_reply_to !== this.props.in_reply_to) { @@ -120,6 +125,13 @@ const ComposeForm = React.createClass({ + + + +