forked from treehouse/mastodon
Re-add unlisted toggle to the UI
parent
6e064cf715
commit
538d109a82
|
@ -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
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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({
|
|||
<Toggle checked={this.props.private} onChange={this.handleChangeVisibility} />
|
||||
<span style={{ display: 'inline-block', verticalAlign: 'middle', marginBottom: '14px', marginLeft: '8px', color: '#9baec8' }}><FormattedMessage id='compose_form.private' defaultMessage='Mark as private' /></span>
|
||||
</label>
|
||||
|
||||
<label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle', marginTop: '10px', borderTop: '1px solid #282c37', paddingTop: '10px' }}>
|
||||
<Toggle checked={this.props.private} onChange={this.handleChangeListability} />
|
||||
<span style={{ display: 'inline-block', verticalAlign: 'middle', marginBottom: '14px', marginLeft: '8px', color: '#9baec8' }}><FormattedMessage id='compose_form.unlisted' defaultMessage='Do not display in public timeline' /></span>
|
||||
</label>
|
||||
|
||||
<span style={{ display: 'block', verticalAlign: 'middle', marginTop: '10px', marginBottom: '10px', marginLeft: '8px', color: '#9baec8' }}><FormattedMessage id='compose_form.unlisted_caveat' defaultMessage='(Private posts will never display in public timeline.)' /></span>
|
||||
|
||||
<label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle' }}>
|
||||
<Toggle checked={this.props.sensitive} onChange={this.handleChangeSensitivity} />
|
||||
|
|
|
@ -8,7 +8,8 @@ import {
|
|||
fetchComposeSuggestions,
|
||||
selectComposeSuggestion,
|
||||
changeComposeSensitivity,
|
||||
changeComposeVisibility
|
||||
changeComposeVisibility,
|
||||
changeComposeListability
|
||||
} from '../../../actions/compose';
|
||||
import { makeGetStatus } from '../../../selectors';
|
||||
|
||||
|
@ -21,6 +22,7 @@ const makeMapStateToProps = () => {
|
|||
suggestion_token: state.getIn(['compose', 'suggestion_token']),
|
||||
suggestions: state.getIn(['compose', 'suggestions']),
|
||||
sensitive: state.getIn(['compose', 'sensitive']),
|
||||
unlisted: state.getIn(['compose', 'unlisted']),
|
||||
private: state.getIn(['compose', 'private']),
|
||||
is_submitting: state.getIn(['compose', 'is_submitting']),
|
||||
is_uploading: state.getIn(['compose', 'is_uploading']),
|
||||
|
@ -63,6 +65,10 @@ const mapDispatchToProps = function (dispatch) {
|
|||
|
||||
onChangeVisibility (checked) {
|
||||
dispatch(changeComposeVisibility(checked));
|
||||
},
|
||||
|
||||
onChangeListability (checked) {
|
||||
dispatch(changeComposeListability(checked));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,7 +17,8 @@ import {
|
|||
COMPOSE_SUGGESTIONS_READY,
|
||||
COMPOSE_SUGGESTION_SELECT,
|
||||
COMPOSE_SENSITIVITY_CHANGE,
|
||||
COMPOSE_VISIBILITY_CHANGE
|
||||
COMPOSE_VISIBILITY_CHANGE,
|
||||
COMPOSE_LISTABILITY_CHANGE
|
||||
} from '../actions/compose';
|
||||
import { TIMELINE_DELETE } from '../actions/timelines';
|
||||
import { ACCOUNT_SET_SELF } from '../actions/accounts';
|
||||
|
@ -26,6 +27,7 @@ import Immutable from 'immutable';
|
|||
const initialState = Immutable.Map({
|
||||
mounted: false,
|
||||
sensitive: false,
|
||||
unlisted: false,
|
||||
private: false,
|
||||
text: '',
|
||||
in_reply_to: null,
|
||||
|
@ -93,6 +95,8 @@ export default function compose(state = initialState, action) {
|
|||
return state.set('sensitive', action.checked);
|
||||
case COMPOSE_VISIBILITY_CHANGE:
|
||||
return state.set('private', action.checked);
|
||||
case COMPOSE_LISTABILITY_CHANGE:
|
||||
return state.set('unlisted', action.checked);
|
||||
case COMPOSE_CHANGE:
|
||||
return state.set('text', action.text);
|
||||
case COMPOSE_REPLY:
|
||||
|
|
Loading…
Reference in New Issue