Compose form in the UI now has public/private toggle instead of public/unlisted
This commit is contained in:
		
							parent
							
								
									b302b9202b
								
							
						
					
					
						commit
						de9b6e3a6a
					
				
					 5 changed files with 10 additions and 10 deletions
				
			
		| 
						 | 
					@ -67,14 +67,14 @@ export function submitCompose() {
 | 
				
			||||||
      in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
 | 
					      in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
 | 
				
			||||||
      media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')),
 | 
					      media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')),
 | 
				
			||||||
      sensitive: getState().getIn(['compose', 'sensitive']),
 | 
					      sensitive: getState().getIn(['compose', 'sensitive']),
 | 
				
			||||||
      visibility: getState().getIn(['compose', 'unlisted']) ? 'unlisted' : 'public'
 | 
					      visibility: getState().getIn(['compose', 'private']) ? 'private' : 'public'
 | 
				
			||||||
    }).then(function (response) {
 | 
					    }).then(function (response) {
 | 
				
			||||||
      dispatch(submitComposeSuccess({ ...response.data }));
 | 
					      dispatch(submitComposeSuccess({ ...response.data }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // To make the app more responsive, immediately get the status into the columns
 | 
					      // To make the app more responsive, immediately get the status into the columns
 | 
				
			||||||
      dispatch(updateTimeline('home', { ...response.data }));
 | 
					      dispatch(updateTimeline('home', { ...response.data }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (response.data.in_reply_to_id === null && !getState().getIn(['compose', 'unlisted'])) {
 | 
					      if (response.data.in_reply_to_id === null && !getState().getIn(['compose', 'private'])) {
 | 
				
			||||||
        dispatch(updateTimeline('public', { ...response.data }));
 | 
					        dispatch(updateTimeline('public', { ...response.data }));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }).catch(function (error) {
 | 
					    }).catch(function (error) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,8 +117,8 @@ const ComposeForm = React.createClass({
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle', marginTop: '10px', borderTop: '1px solid #282c37', paddingTop: '10px' }}>
 | 
					        <label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle', marginTop: '10px', borderTop: '1px solid #282c37', paddingTop: '10px' }}>
 | 
				
			||||||
          <Toggle checked={this.props.unlisted} onChange={this.handleChangeVisibility} />
 | 
					          <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.unlisted' defaultMessage='Do not show on public timeline' /></span>
 | 
					          <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>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle' }}>
 | 
					        <label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle' }}>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ const makeMapStateToProps = () => {
 | 
				
			||||||
      suggestion_token: state.getIn(['compose', 'suggestion_token']),
 | 
					      suggestion_token: state.getIn(['compose', 'suggestion_token']),
 | 
				
			||||||
      suggestions: state.getIn(['compose', 'suggestions']),
 | 
					      suggestions: state.getIn(['compose', 'suggestions']),
 | 
				
			||||||
      sensitive: state.getIn(['compose', 'sensitive']),
 | 
					      sensitive: state.getIn(['compose', 'sensitive']),
 | 
				
			||||||
      unlisted: state.getIn(['compose', 'unlisted']),
 | 
					      private: state.getIn(['compose', 'private']),
 | 
				
			||||||
      is_submitting: state.getIn(['compose', 'is_submitting']),
 | 
					      is_submitting: state.getIn(['compose', 'is_submitting']),
 | 
				
			||||||
      is_uploading: state.getIn(['compose', 'is_uploading']),
 | 
					      is_uploading: state.getIn(['compose', 'is_uploading']),
 | 
				
			||||||
      in_reply_to: getStatus(state, state.getIn(['compose', 'in_reply_to']))
 | 
					      in_reply_to: getStatus(state, state.getIn(['compose', 'in_reply_to']))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,8 +37,8 @@ const en = {
 | 
				
			||||||
  "tabs_bar.notifications": "Notifications",
 | 
					  "tabs_bar.notifications": "Notifications",
 | 
				
			||||||
  "compose_form.placeholder": "What is on your mind?",
 | 
					  "compose_form.placeholder": "What is on your mind?",
 | 
				
			||||||
  "compose_form.publish": "Toot",
 | 
					  "compose_form.publish": "Toot",
 | 
				
			||||||
  "compose_form.sensitive": "Mark content as sensitive",
 | 
					  "compose_form.sensitive": "Mark media as sensitive",
 | 
				
			||||||
  "compose_form.unlisted": "Do not show on public timeline",
 | 
					  "compose_form.private": "Mark as private",
 | 
				
			||||||
  "navigation_bar.settings": "Settings",
 | 
					  "navigation_bar.settings": "Settings",
 | 
				
			||||||
  "navigation_bar.public_timeline": "Public timeline",
 | 
					  "navigation_bar.public_timeline": "Public timeline",
 | 
				
			||||||
  "navigation_bar.logout": "Logout",
 | 
					  "navigation_bar.logout": "Logout",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ import Immutable from 'immutable';
 | 
				
			||||||
const initialState = Immutable.Map({
 | 
					const initialState = Immutable.Map({
 | 
				
			||||||
  mounted: false,
 | 
					  mounted: false,
 | 
				
			||||||
  sensitive: false,
 | 
					  sensitive: false,
 | 
				
			||||||
  unlisted: false,
 | 
					  private: false,
 | 
				
			||||||
  text: '',
 | 
					  text: '',
 | 
				
			||||||
  in_reply_to: null,
 | 
					  in_reply_to: null,
 | 
				
			||||||
  is_submitting: false,
 | 
					  is_submitting: false,
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ export default function compose(state = initialState, action) {
 | 
				
			||||||
    case COMPOSE_SENSITIVITY_CHANGE:
 | 
					    case COMPOSE_SENSITIVITY_CHANGE:
 | 
				
			||||||
      return state.set('sensitive', action.checked);
 | 
					      return state.set('sensitive', action.checked);
 | 
				
			||||||
    case COMPOSE_VISIBILITY_CHANGE:
 | 
					    case COMPOSE_VISIBILITY_CHANGE:
 | 
				
			||||||
      return state.set('unlisted', action.checked);
 | 
					      return state.set('private', action.checked);
 | 
				
			||||||
    case COMPOSE_CHANGE:
 | 
					    case COMPOSE_CHANGE:
 | 
				
			||||||
      return state.set('text', action.text);
 | 
					      return state.set('text', action.text);
 | 
				
			||||||
    case COMPOSE_REPLY:
 | 
					    case COMPOSE_REPLY:
 | 
				
			||||||
| 
						 | 
					@ -136,7 +136,7 @@ export default function compose(state = initialState, action) {
 | 
				
			||||||
        return state;
 | 
					        return state;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    case ACCOUNT_SET_SELF:
 | 
					    case ACCOUNT_SET_SELF:
 | 
				
			||||||
      return state.set('me', action.account.id);
 | 
					      return state.set('me', action.account.id).set('private', action.account.locked);
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
      return state;
 | 
					      return state;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue