Per-status control for unlisted mode, also federation for unlisted mode
Fix #233, fix #268
This commit is contained in:
		
							parent
							
								
									1b447c190e
								
							
						
					
					
						commit
						14bd46946d
					
				
					 31 changed files with 175 additions and 82 deletions
				
			
		|  | @ -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 | ||||
|   }; | ||||
| }; | ||||
|  |  | |||
|  | @ -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({ | |||
|           <UploadButtonContainer style={{ paddingTop: '4px' }} /> | ||||
|         </div> | ||||
| 
 | ||||
|         <label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle', marginTop: '10px', borderTop: '1px solid #616b86', 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} /> | ||||
|           <span style={{ display: 'inline-block', verticalAlign: 'middle', marginBottom: '14px', marginLeft: '8px', color: '#9baec8' }}><FormattedMessage id='compose_form.unlisted' defaultMessage='Unlisted mode' /></span> | ||||
|         </label> | ||||
| 
 | ||||
|         <label style={{ display: 'block', lineHeight: '24px', verticalAlign: 'middle' }}> | ||||
|           <Toggle checked={this.props.sensitive} onChange={this.handleChangeSensitivity} /> | ||||
|           <span style={{ display: 'inline-block', verticalAlign: 'middle', marginBottom: '14px', marginLeft: '8px', color: '#9baec8' }}><FormattedMessage id='compose_form.sensitive' defaultMessage='Mark content as sensitive' /></span> | ||||
|         </label> | ||||
|  |  | |||
|  | @ -7,7 +7,8 @@ import { | |||
|   clearComposeSuggestions, | ||||
|   fetchComposeSuggestions, | ||||
|   selectComposeSuggestion, | ||||
|   changeComposeSensitivity | ||||
|   changeComposeSensitivity, | ||||
|   changeComposeVisibility | ||||
| } from '../../../actions/compose'; | ||||
| import { makeGetStatus } from '../../../selectors'; | ||||
| 
 | ||||
|  | @ -20,6 +21,7 @@ const makeMapStateToProps = () => { | |||
|       suggestion_token: state.getIn(['compose', 'suggestion_token']), | ||||
|       suggestions: state.getIn(['compose', 'suggestions']).toJS(), | ||||
|       sensitive: state.getIn(['compose', 'sensitive']), | ||||
|       unlisted: state.getIn(['compose', 'unlisted']), | ||||
|       is_submitting: state.getIn(['compose', 'is_submitting']), | ||||
|       is_uploading: state.getIn(['compose', 'is_uploading']), | ||||
|       in_reply_to: getStatus(state, state.getIn(['compose', 'in_reply_to'])) | ||||
|  | @ -57,6 +59,10 @@ const mapDispatchToProps = function (dispatch) { | |||
| 
 | ||||
|     onChangeSensitivity (checked) { | ||||
|       dispatch(changeComposeSensitivity(checked)); | ||||
|     }, | ||||
| 
 | ||||
|     onChangeVisibility (checked) { | ||||
|       dispatch(changeComposeVisibility(checked)); | ||||
|     } | ||||
|   } | ||||
| }; | ||||
|  |  | |||
|  | @ -34,6 +34,8 @@ const en = { | |||
|   "tabs_bar.notifications": "Mitteilungen", | ||||
|   "compose_form.placeholder": "Worüber möchstest du schreiben?", | ||||
|   "compose_form.publish": "Veröffentlichen", | ||||
|   "compose_form.sensitive": "Medien als sensitiv markieren", | ||||
|   "compose_form.unlisted": "Öffentlich nicht auflisten", | ||||
|   "navigation_bar.settings": "Einstellungen", | ||||
|   "navigation_bar.public_timeline": "Öffentlich", | ||||
|   "navigation_bar.logout": "Abmelden", | ||||
|  |  | |||
|  | @ -38,6 +38,7 @@ const en = { | |||
|   "compose_form.placeholder": "What is on your mind?", | ||||
|   "compose_form.publish": "Toot", | ||||
|   "compose_form.sensitive": "Mark content as sensitive", | ||||
|   "compose_form.unlisted": "Unlisted mode", | ||||
|   "navigation_bar.settings": "Settings", | ||||
|   "navigation_bar.public_timeline": "Public timeline", | ||||
|   "navigation_bar.logout": "Logout", | ||||
|  |  | |||
|  | @ -35,6 +35,8 @@ const es = { | |||
|   "tabs_bar.notifications": "Notificaciones", | ||||
|   "compose_form.placeholder": "¿En qué estás pensando?", | ||||
|   "compose_form.publish": "Publicar", | ||||
|   "compose_form.sensitive": null, | ||||
|   "compose_form.unlisted": "No listado", | ||||
|   "navigation_bar.settings": "Ajustes", | ||||
|   "navigation_bar.public_timeline": "Público", | ||||
|   "navigation_bar.logout": "Cerrar sesión", | ||||
|  |  | |||
|  | @ -36,7 +36,8 @@ const fr = { | |||
|   "tabs_bar.notifications": "Notifications", | ||||
|   "compose_form.placeholder": "Qu’avez-vous en tête ?", | ||||
|   "compose_form.publish": "Pouet", | ||||
|   "compose_form.sensitive": "Marquer le contenu comme délicat",  | ||||
|   "compose_form.sensitive": "Marquer le contenu comme délicat", | ||||
|   "compose_form.unlisted": "Ne pas apparaître dans le fil public", | ||||
|   "navigation_bar.settings": "Paramètres", | ||||
|   "navigation_bar.public_timeline": "Public", | ||||
|   "navigation_bar.logout": "Déconnexion", | ||||
|  |  | |||
|  | @ -37,6 +37,7 @@ const hu = { | |||
|   "compose_form.placeholder": "Mire gondolsz?", | ||||
|   "compose_form.publish": "Tülk!", | ||||
|   "compose_form.sensitive": "Tartalom érzékenynek jelölése", | ||||
|   "compose_form.unlisted": "Listázatlan mód", | ||||
|   "navigation_bar.settings": "Beállítások", | ||||
|   "navigation_bar.public_timeline": "Nyilvános időfolyam", | ||||
|   "navigation_bar.logout": "Kijelentkezés", | ||||
|  |  | |||
|  | @ -33,6 +33,8 @@ const pt = { | |||
|   "tabs_bar.public": "Público", | ||||
|   "compose_form.placeholder": "Que estás pensando?", | ||||
|   "compose_form.publish": "Publicar", | ||||
|   "compose_form.sensitive": null, | ||||
|   "compose_form.unlisted": null, | ||||
|   "navigation_bar.settings": "Configurações", | ||||
|   "navigation_bar.public_timeline": "Timeline Pública", | ||||
|   "navigation_bar.logout": "Logout", | ||||
|  |  | |||
|  | @ -16,7 +16,8 @@ import { | |||
|   COMPOSE_SUGGESTIONS_CLEAR, | ||||
|   COMPOSE_SUGGESTIONS_READY, | ||||
|   COMPOSE_SUGGESTION_SELECT, | ||||
|   COMPOSE_SENSITIVITY_CHANGE | ||||
|   COMPOSE_SENSITIVITY_CHANGE, | ||||
|   COMPOSE_VISIBILITY_CHANGE | ||||
| } from '../actions/compose'; | ||||
| import { TIMELINE_DELETE } from '../actions/timelines'; | ||||
| import { ACCOUNT_SET_SELF } from '../actions/accounts'; | ||||
|  | @ -25,6 +26,7 @@ import Immutable from 'immutable'; | |||
| const initialState = Immutable.Map({ | ||||
|   mounted: false, | ||||
|   sensitive: false, | ||||
|   unlisted: false, | ||||
|   text: '', | ||||
|   in_reply_to: null, | ||||
|   is_submitting: false, | ||||
|  | @ -91,6 +93,8 @@ export default function compose(state = initialState, action) { | |||
|       return state.set('mounted', false); | ||||
|     case COMPOSE_SENSITIVITY_CHANGE: | ||||
|       return state.set('sensitive', action.checked); | ||||
|     case COMPOSE_VISIBILITY_CHANGE: | ||||
|       return state.set('unlisted', action.checked); | ||||
|     case COMPOSE_CHANGE: | ||||
|       return state.set('text', action.text); | ||||
|     case COMPOSE_REPLY: | ||||
|  |  | |||
		Reference in a new issue