From 14bd46946d25186044485aa101dd2da976b61181 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 30 Nov 2016 21:32:11 +0100 Subject: Per-status control for unlisted mode, also federation for unlisted mode Fix #233, fix #268 --- app/assets/javascripts/components/actions/compose.jsx | 11 ++++++++++- .../features/compose/components/compose_form.jsx | 15 +++++++++++++-- .../compose/containers/compose_form_container.jsx | 8 +++++++- app/assets/javascripts/components/locales/de.jsx | 2 ++ app/assets/javascripts/components/locales/en.jsx | 1 + app/assets/javascripts/components/locales/es.jsx | 2 ++ app/assets/javascripts/components/locales/fr.jsx | 3 ++- app/assets/javascripts/components/locales/hu.jsx | 1 + app/assets/javascripts/components/locales/pt.jsx | 2 ++ app/assets/javascripts/components/reducers/compose.jsx | 6 +++++- 10 files changed, 45 insertions(+), 6 deletions(-) (limited to 'app/assets/javascripts/components') diff --git a/app/assets/javascripts/components/actions/compose.jsx b/app/assets/javascripts/components/actions/compose.jsx index b97cb7b12..c2a7909f6 100644 --- a/app/assets/javascripts/components/actions/compose.jsx +++ b/app/assets/javascripts/components/actions/compose.jsx @@ -23,6 +23,7 @@ export const COMPOSE_MOUNT = 'COMPOSE_MOUNT'; export const COMPOSE_UNMOUNT = 'COMPOSE_UNMOUNT'; export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE'; +export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE'; export function changeCompose(text) { return { @@ -65,7 +66,8 @@ export function submitCompose() { status: getState().getIn(['compose', 'text'], ''), 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']) + sensitive: getState().getIn(['compose', 'sensitive']), + unlisted: getState().getIn(['compose', 'unlisted']) }).then(function (response) { dispatch(submitComposeSuccess(response.data)); dispatch(updateTimeline('home', response.data)); @@ -207,3 +209,10 @@ export function changeComposeSensitivity(checked) { checked }; }; + +export function changeComposeVisibility(checked) { + return { + type: COMPOSE_VISIBILITY_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 b16731c05..4688f39d3 100644 --- a/app/assets/javascripts/components/features/compose/components/compose_form.jsx +++ b/app/assets/javascripts/components/features/compose/components/compose_form.jsx @@ -70,6 +70,7 @@ const ComposeForm = React.createClass({ suggestion_token: React.PropTypes.string, suggestions: React.PropTypes.array, sensitive: React.PropTypes.bool, + unlisted: React.PropTypes.bool, is_submitting: React.PropTypes.bool, is_uploading: React.PropTypes.bool, in_reply_to: ImmutablePropTypes.map, @@ -79,7 +80,8 @@ const ComposeForm = React.createClass({ onClearSuggestions: React.PropTypes.func.isRequired, onFetchSuggestions: React.PropTypes.func.isRequired, onSuggestionSelected: React.PropTypes.func.isRequired, - onChangeSensitivity: React.PropTypes.func.isRequired + onChangeSensitivity: React.PropTypes.func.isRequired, + onChangeVisibility: React.PropTypes.func.isRequired }, mixins: [PureRenderMixin], @@ -147,6 +149,10 @@ const ComposeForm = React.createClass({ this.props.onChangeSensitivity(e.target.checked); }, + handleChangeVisibility (e) { + this.props.onChangeVisibility(e.target.checked); + }, + render () { const { intl } = this.props; let replyArea = ''; @@ -187,7 +193,12 @@ const ComposeForm = React.createClass({ -