Only display follow requests link in getting started window if account is locked

This commit is contained in:
Eugen Rochko 2016-12-26 21:55:52 +01:00
parent 2146ac91a0
commit 5418df467d

View file

@ -3,6 +3,7 @@ import ColumnLink from '../ui/components/column_link';
import { Link } from 'react-router'; import { Link } from 'react-router';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
const messages = defineMessages({ const messages = defineMessages({
heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
@ -12,7 +13,7 @@ const messages = defineMessages({
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
me: state.getIn(['meta', 'me']) me: state.getIn(['accounts', state.getIn(['meta', 'me'])])
}); });
const hamburgerStyle = { const hamburgerStyle = {
@ -27,13 +28,19 @@ const hamburgerStyle = {
}; };
const GettingStarted = ({ intl, me }) => { const GettingStarted = ({ intl, me }) => {
let followRequests = '';
if (me.get('locked')) {
followRequests = <ColumnLink icon='users' text={intl.formatMessage(messages.follow_requests)} to='/follow_requests' />;
}
return ( return (
<Column icon='asterisk' heading={intl.formatMessage(messages.heading)}> <Column icon='asterisk' heading={intl.formatMessage(messages.heading)}>
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<div style={hamburgerStyle}><i className='fa fa-bars' /></div> <div style={hamburgerStyle}><i className='fa fa-bars' /></div>
<ColumnLink icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/timelines/public' /> <ColumnLink icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/timelines/public' />
<ColumnLink icon='cog' text={intl.formatMessage(messages.settings)} href='/settings/profile' /> <ColumnLink icon='cog' text={intl.formatMessage(messages.settings)} href='/settings/profile' />
<ColumnLink icon='users' text={intl.formatMessage(messages.follow_requests)} to='/follow_requests' /> {followRequests}
</div> </div>
<div className='static-content'> <div className='static-content'>
@ -47,7 +54,7 @@ const GettingStarted = ({ intl, me }) => {
GettingStarted.propTypes = { GettingStarted.propTypes = {
intl: React.PropTypes.object.isRequired, intl: React.PropTypes.object.isRequired,
me: React.PropTypes.number me: ImmutablePropTypes.map.isRequired
}; };
export default connect(mapStateToProps)(injectIntl(GettingStarted)); export default connect(mapStateToProps)(injectIntl(GettingStarted));