Fix up visual indicators for compose form privacy

This commit is contained in:
Eugen Rochko 2017-03-25 20:24:30 +01:00
parent b8f9de8636
commit 1fd88e3bad
2 changed files with 5 additions and 7 deletions

View file

@ -30,8 +30,7 @@ const ComposeForm = React.createClass({
suggestion_token: React.PropTypes.string, suggestion_token: React.PropTypes.string,
suggestions: ImmutablePropTypes.list, suggestions: ImmutablePropTypes.list,
spoiler: React.PropTypes.bool, spoiler: React.PropTypes.bool,
private: React.PropTypes.bool, privacy: React.PropTypes.string,
unlisted: React.PropTypes.bool,
spoiler_text: React.PropTypes.string, spoiler_text: React.PropTypes.string,
focusDate: React.PropTypes.instanceOf(Date), focusDate: React.PropTypes.instanceOf(Date),
preselectDate: React.PropTypes.instanceOf(Date), preselectDate: React.PropTypes.instanceOf(Date),
@ -137,10 +136,10 @@ const ComposeForm = React.createClass({
); );
} }
if (this.props.private) { if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
publishText = <span><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>; publishText = <span><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>;
} else { } else {
publishText = intl.formatMessage(messages.publish) + (!this.props.unlisted ? '!' : ''); publishText = intl.formatMessage(messages.publish) + (this.props.privacy !== 'unlisted' ? '!' : '');
} }
return ( return (

View file

@ -28,14 +28,13 @@ const mapStateToProps = (state, props) => {
suggestions: state.getIn(['compose', 'suggestions']), suggestions: state.getIn(['compose', 'suggestions']),
spoiler: state.getIn(['compose', 'spoiler']), spoiler: state.getIn(['compose', 'spoiler']),
spoiler_text: state.getIn(['compose', 'spoiler_text']), spoiler_text: state.getIn(['compose', 'spoiler_text']),
unlisted: state.getIn(['compose', 'unlisted'], ), privacy: state.getIn(['compose', 'privacy']),
private: state.getIn(['compose', 'private']),
focusDate: state.getIn(['compose', 'focusDate']), focusDate: state.getIn(['compose', 'focusDate']),
preselectDate: state.getIn(['compose', 'preselectDate']), preselectDate: state.getIn(['compose', 'preselectDate']),
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']),
me: state.getIn(['compose', 'me']), me: state.getIn(['compose', 'me']),
needsPrivacyWarning: state.getIn(['compose', 'private']) && mentionedUsernames !== null, needsPrivacyWarning: (state.getIn(['compose', 'privacy']) === 'private' || state.getIn(['compose', 'privacy']) === 'direct') && mentionedUsernames !== null,
mentionedDomains: mentionedUsernamesWithDomains mentionedDomains: mentionedUsernamesWithDomains
}; };
}; };