0
0
Fork 0

Refactor initial state: "me" (#5563)

* Refactor initial state: "me"

* remove "me" from reducers/meta.js
This commit is contained in:
Nolan Lawson 2017-10-30 19:27:48 -07:00 committed by Yamagishi Kazutoshi
parent 29609fbb6a
commit b254e6ca5f
24 changed files with 44 additions and 60 deletions

View file

@ -7,6 +7,7 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { me } from '../../initial_state';
const messages = defineMessages({
heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
@ -27,7 +28,7 @@ const messages = defineMessages({
});
const mapStateToProps = state => ({
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
myAccount: state.getIn(['accounts', me]),
columns: state.getIn(['settings', 'columns']),
});
@ -37,13 +38,13 @@ export default class GettingStarted extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
me: ImmutablePropTypes.map.isRequired,
myAccount: ImmutablePropTypes.map.isRequired,
columns: ImmutablePropTypes.list,
multiColumn: PropTypes.bool,
};
render () {
const { intl, me, columns, multiColumn } = this.props;
const { intl, myAccount, columns, multiColumn } = this.props;
let navItems = [];
@ -70,7 +71,7 @@ export default class GettingStarted extends ImmutablePureComponent {
<ColumnLink key='5' icon='thumb-tack' text={intl.formatMessage(messages.pins)} to='/pinned' />,
]);
if (me.get('locked')) {
if (myAccount.get('locked')) {
navItems.push(<ColumnLink key='6' icon='users' text={intl.formatMessage(messages.follow_requests)} to='/follow_requests' />);
}