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

@ -4,12 +4,13 @@ export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST';
export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS';
export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL'; export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL';
import { me } from '../initial_state';
export function fetchPinnedStatuses() { export function fetchPinnedStatuses() {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(fetchPinnedStatusesRequest()); dispatch(fetchPinnedStatusesRequest());
const accountId = getState().getIn(['meta', 'me']); api(getState).get(`/api/v1/accounts/${me}/statuses`, { params: { pinned: true } }).then(response => {
api(getState).get(`/api/v1/accounts/${accountId}/statuses`, { params: { pinned: true } }).then(response => {
dispatch(fetchPinnedStatusesSuccess(response.data, null)); dispatch(fetchPinnedStatusesSuccess(response.data, null));
}).catch(error => { }).catch(error => {
dispatch(fetchPinnedStatusesFail(error)); dispatch(fetchPinnedStatusesFail(error));

View File

@ -7,6 +7,7 @@ import Permalink from './permalink';
import IconButton from './icon_button'; import IconButton from './icon_button';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { me } from '../initial_state';
const messages = defineMessages({ const messages = defineMessages({
follow: { id: 'account.follow', defaultMessage: 'Follow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' },
@ -21,7 +22,6 @@ export default class Account extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired, account: ImmutablePropTypes.map.isRequired,
me: PropTypes.string.isRequired,
onFollow: PropTypes.func.isRequired, onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired,
onMute: PropTypes.func.isRequired, onMute: PropTypes.func.isRequired,
@ -42,7 +42,7 @@ export default class Account extends ImmutablePureComponent {
} }
render () { render () {
const { account, me, intl, hidden } = this.props; const { account, intl, hidden } = this.props;
if (!account) { if (!account) {
return <div />; return <div />;

View File

@ -36,7 +36,6 @@ export default class Status extends ImmutablePureComponent {
onBlock: PropTypes.func, onBlock: PropTypes.func,
onEmbed: PropTypes.func, onEmbed: PropTypes.func,
onHeightChange: PropTypes.func, onHeightChange: PropTypes.func,
me: PropTypes.string,
muted: PropTypes.bool, muted: PropTypes.bool,
hidden: PropTypes.bool, hidden: PropTypes.bool,
onMoveUp: PropTypes.func, onMoveUp: PropTypes.func,
@ -52,7 +51,6 @@ export default class Status extends ImmutablePureComponent {
updateOnProps = [ updateOnProps = [
'status', 'status',
'account', 'account',
'me',
'muted', 'muted',
'hidden', 'hidden',
] ]

View File

@ -5,6 +5,7 @@ import IconButton from './icon_button';
import DropdownMenuContainer from '../containers/dropdown_menu_container'; import DropdownMenuContainer from '../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { me } from '../initial_state';
const messages = defineMessages({ const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' }, delete: { id: 'status.delete', defaultMessage: 'Delete' },
@ -47,7 +48,6 @@ export default class StatusActionBar extends ImmutablePureComponent {
onEmbed: PropTypes.func, onEmbed: PropTypes.func,
onMuteConversation: PropTypes.func, onMuteConversation: PropTypes.func,
onPin: PropTypes.func, onPin: PropTypes.func,
me: PropTypes.string,
withDismiss: PropTypes.bool, withDismiss: PropTypes.bool,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -56,7 +56,6 @@ export default class StatusActionBar extends ImmutablePureComponent {
// evaluate to false. See react-immutable-pure-component for usage. // evaluate to false. See react-immutable-pure-component for usage.
updateOnProps = [ updateOnProps = [
'status', 'status',
'me',
'withDismiss', 'withDismiss',
] ]
@ -116,7 +115,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
} }
render () { render () {
const { status, me, intl, withDismiss } = this.props; const { status, intl, withDismiss } = this.props;
const mutingConversation = status.get('muted'); const mutingConversation = status.get('muted');
const anonymousAccess = !me; const anonymousAccess = !me;

View File

@ -23,7 +23,6 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id), account: getAccount(state, props.id),
me: state.getIn(['meta', 'me']),
}); });
return mapStateToProps; return mapStateToProps;

View File

@ -36,7 +36,6 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
status: getStatus(state, props.id), status: getStatus(state, props.id),
me: state.getIn(['meta', 'me']),
}); });
return mapStateToProps; return mapStateToProps;

View File

@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl';
import { me } from '../../../initial_state';
const messages = defineMessages({ const messages = defineMessages({
mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' }, mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' },
@ -26,7 +27,6 @@ export default class ActionBar extends React.PureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map.isRequired, account: ImmutablePropTypes.map.isRequired,
me: PropTypes.string.isRequired,
onFollow: PropTypes.func, onFollow: PropTypes.func,
onBlock: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired, onMention: PropTypes.func.isRequired,
@ -44,7 +44,7 @@ export default class ActionBar extends React.PureComponent {
} }
render () { render () {
const { account, me, intl } = this.props; const { account, intl } = this.props;
let menu = []; let menu = [];
let extraInfo = ''; let extraInfo = '';

View File

@ -6,7 +6,7 @@ import IconButton from '../../../components/icon_button';
import Motion from '../../ui/util/optional_motion'; import Motion from '../../ui/util/optional_motion';
import spring from 'react-motion/lib/spring'; import spring from 'react-motion/lib/spring';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { autoPlayGif } from '../../../initial_state'; import { autoPlayGif, me } from '../../../initial_state';
const messages = defineMessages({ const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
@ -67,13 +67,12 @@ export default class Header extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
me: PropTypes.string.isRequired,
onFollow: PropTypes.func.isRequired, onFollow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
render () { render () {
const { account, me, intl } = this.props; const { account, intl } = this.props;
if (!account) { if (!account) {
return null; return null;

View File

@ -10,7 +10,6 @@ export default class Header extends ImmutablePureComponent {
static propTypes = { static propTypes = {
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
me: PropTypes.string.isRequired,
onFollow: PropTypes.func.isRequired, onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired, onMention: PropTypes.func.isRequired,
@ -61,7 +60,7 @@ export default class Header extends ImmutablePureComponent {
} }
render () { render () {
const { account, me } = this.props; const { account } = this.props;
if (account === null) { if (account === null) {
return <MissingIndicator />; return <MissingIndicator />;
@ -71,13 +70,11 @@ export default class Header extends ImmutablePureComponent {
<div className='account-timeline__header'> <div className='account-timeline__header'>
<InnerHeader <InnerHeader
account={account} account={account}
me={me}
onFollow={this.handleFollow} onFollow={this.handleFollow}
/> />
<ActionBar <ActionBar
account={account} account={account}
me={me}
onBlock={this.handleBlock} onBlock={this.handleBlock}
onMention={this.handleMention} onMention={this.handleMention}
onReport={this.handleReport} onReport={this.handleReport}

View File

@ -29,7 +29,6 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { accountId }) => ({ const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, accountId), account: getAccount(state, accountId),
me: state.getIn(['meta', 'me']),
}); });
return mapStateToProps; return mapStateToProps;

View File

@ -16,7 +16,6 @@ const mapStateToProps = (state, props) => ({
statusIds: state.getIn(['timelines', `account:${props.params.accountId}`, 'items'], ImmutableList()), statusIds: state.getIn(['timelines', `account:${props.params.accountId}`, 'items'], ImmutableList()),
isLoading: state.getIn(['timelines', `account:${props.params.accountId}`, 'isLoading']), isLoading: state.getIn(['timelines', `account:${props.params.accountId}`, 'isLoading']),
hasMore: !!state.getIn(['timelines', `account:${props.params.accountId}`, 'next']), hasMore: !!state.getIn(['timelines', `account:${props.params.accountId}`, 'next']),
me: state.getIn(['meta', 'me']),
}); });
@connect(mapStateToProps) @connect(mapStateToProps)
@ -28,7 +27,6 @@ export default class AccountTimeline extends ImmutablePureComponent {
statusIds: ImmutablePropTypes.list, statusIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
hasMore: PropTypes.bool, hasMore: PropTypes.bool,
me: PropTypes.string.isRequired,
}; };
componentWillMount () { componentWillMount () {
@ -50,7 +48,7 @@ export default class AccountTimeline extends ImmutablePureComponent {
} }
render () { render () {
const { statusIds, isLoading, hasMore, me } = this.props; const { statusIds, isLoading, hasMore } = this.props;
if (!statusIds && isLoading) { if (!statusIds && isLoading) {
return ( return (
@ -70,7 +68,6 @@ export default class AccountTimeline extends ImmutablePureComponent {
statusIds={statusIds} statusIds={statusIds}
isLoading={isLoading} isLoading={isLoading}
hasMore={hasMore} hasMore={hasMore}
me={me}
onScrollToBottom={this.handleScrollToBottom} onScrollToBottom={this.handleScrollToBottom}
/> />
</Column> </Column>

View File

@ -41,7 +41,6 @@ export default class ComposeForm extends ImmutablePureComponent {
preselectDate: PropTypes.instanceOf(Date), preselectDate: PropTypes.instanceOf(Date),
is_submitting: PropTypes.bool, is_submitting: PropTypes.bool,
is_uploading: PropTypes.bool, is_uploading: PropTypes.bool,
me: PropTypes.string,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired,
onClearSuggestions: PropTypes.func.isRequired, onClearSuggestions: PropTypes.func.isRequired,

View File

@ -22,7 +22,6 @@ const mapStateToProps = state => ({
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']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
}); });

View File

@ -1,9 +1,10 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import NavigationBar from '../components/navigation_bar'; import NavigationBar from '../components/navigation_bar';
import { me } from '../../../initial_state';
const mapStateToProps = state => { const mapStateToProps = state => {
return { return {
account: state.getIn(['accounts', state.getIn(['meta', 'me'])]), account: state.getIn(['accounts', me]),
}; };
}; };

View File

@ -3,9 +3,10 @@ import { connect } from 'react-redux';
import Warning from '../components/warning'; import Warning from '../components/warning';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { me } from '../../../initial_state';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', state.getIn(['meta', 'me']), 'locked']), needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
}); });
const WarningWrapper = ({ needsLockWarning }) => { const WarningWrapper = ({ needsLockWarning }) => {

View File

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

View File

@ -4,6 +4,7 @@ import IconButton from '../../../components/icon_button';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import { me } from '../../../initial_state';
const messages = defineMessages({ const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' }, delete: { id: 'status.delete', defaultMessage: 'Delete' },
@ -36,7 +37,6 @@ export default class ActionBar extends React.PureComponent {
onReport: PropTypes.func, onReport: PropTypes.func,
onPin: PropTypes.func, onPin: PropTypes.func,
onEmbed: PropTypes.func, onEmbed: PropTypes.func,
me: PropTypes.string.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -80,7 +80,7 @@ export default class ActionBar extends React.PureComponent {
} }
render () { render () {
const { status, me, intl } = this.props; const { status, intl } = this.props;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));

View File

@ -43,7 +43,6 @@ const makeMapStateToProps = () => {
status: getStatus(state, props.params.statusId), status: getStatus(state, props.params.statusId),
ancestorsIds: state.getIn(['contexts', 'ancestors', props.params.statusId]), ancestorsIds: state.getIn(['contexts', 'ancestors', props.params.statusId]),
descendantsIds: state.getIn(['contexts', 'descendants', props.params.statusId]), descendantsIds: state.getIn(['contexts', 'descendants', props.params.statusId]),
me: state.getIn(['meta', 'me']),
}); });
return mapStateToProps; return mapStateToProps;
@ -63,7 +62,6 @@ export default class Status extends ImmutablePureComponent {
status: ImmutablePropTypes.map, status: ImmutablePropTypes.map,
ancestorsIds: ImmutablePropTypes.list, ancestorsIds: ImmutablePropTypes.list,
descendantsIds: ImmutablePropTypes.list, descendantsIds: ImmutablePropTypes.list,
me: PropTypes.string,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -252,7 +250,7 @@ export default class Status extends ImmutablePureComponent {
render () { render () {
let ancestors, descendants; let ancestors, descendants;
const { status, ancestorsIds, descendantsIds, me } = this.props; const { status, ancestorsIds, descendantsIds } = this.props;
if (status === null) { if (status === null) {
return ( return (
@ -293,14 +291,12 @@ export default class Status extends ImmutablePureComponent {
<div className='focusable' tabIndex='0'> <div className='focusable' tabIndex='0'>
<DetailedStatus <DetailedStatus
status={status} status={status}
me={me}
onOpenVideo={this.handleOpenVideo} onOpenVideo={this.handleOpenVideo}
onOpenMedia={this.handleOpenMedia} onOpenMedia={this.handleOpenMedia}
/> />
<ActionBar <ActionBar
status={status} status={status}
me={me}
onReply={this.handleReplyClick} onReply={this.handleReplyClick}
onFavourite={this.handleFavouriteClick} onFavourite={this.handleFavouriteClick}
onReblog={this.handleReblogClick} onReblog={this.handleReblogClick}

View File

@ -11,6 +11,7 @@ import Search from '../../compose/components/search';
import NavigationBar from '../../compose/components/navigation_bar'; import NavigationBar from '../../compose/components/navigation_bar';
import ColumnHeader from './column_header'; import ColumnHeader from './column_header';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import { me } from '../../../initial_state';
const noop = () => { }; const noop = () => { };
@ -40,11 +41,11 @@ PageOne.propTypes = {
domain: PropTypes.string.isRequired, domain: PropTypes.string.isRequired,
}; };
const PageTwo = ({ me }) => ( const PageTwo = ({ myAccount }) => (
<div className='onboarding-modal__page onboarding-modal__page-two'> <div className='onboarding-modal__page onboarding-modal__page-two'>
<div className='figure non-interactive'> <div className='figure non-interactive'>
<div className='pseudo-drawer'> <div className='pseudo-drawer'>
<NavigationBar account={me} /> <NavigationBar account={myAccount} />
</div> </div>
<ComposeForm <ComposeForm
text='Awoo! #introductions' text='Awoo! #introductions'
@ -68,10 +69,10 @@ const PageTwo = ({ me }) => (
); );
PageTwo.propTypes = { PageTwo.propTypes = {
me: ImmutablePropTypes.map.isRequired, myAccount: ImmutablePropTypes.map.isRequired,
}; };
const PageThree = ({ me }) => ( const PageThree = ({ myAccount }) => (
<div className='onboarding-modal__page onboarding-modal__page-three'> <div className='onboarding-modal__page onboarding-modal__page-three'>
<div className='figure non-interactive'> <div className='figure non-interactive'>
<Search <Search
@ -83,7 +84,7 @@ const PageThree = ({ me }) => (
/> />
<div className='pseudo-drawer'> <div className='pseudo-drawer'>
<NavigationBar account={me} /> <NavigationBar account={myAccount} />
</div> </div>
</div> </div>
@ -93,7 +94,7 @@ const PageThree = ({ me }) => (
); );
PageThree.propTypes = { PageThree.propTypes = {
me: ImmutablePropTypes.map.isRequired, myAccount: ImmutablePropTypes.map.isRequired,
}; };
const PageFour = ({ domain, intl }) => ( const PageFour = ({ domain, intl }) => (
@ -161,7 +162,7 @@ PageSix.propTypes = {
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]), myAccount: state.getIn(['accounts', me]),
admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]), admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),
domain: state.getIn(['meta', 'domain']), domain: state.getIn(['meta', 'domain']),
}); });
@ -173,7 +174,7 @@ export default class OnboardingModal extends React.PureComponent {
static propTypes = { static propTypes = {
onClose: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
me: ImmutablePropTypes.map.isRequired, myAccount: ImmutablePropTypes.map.isRequired,
domain: PropTypes.string.isRequired, domain: PropTypes.string.isRequired,
admin: ImmutablePropTypes.map, admin: ImmutablePropTypes.map,
}; };
@ -183,11 +184,11 @@ export default class OnboardingModal extends React.PureComponent {
}; };
componentWillMount() { componentWillMount() {
const { me, admin, domain, intl } = this.props; const { myAccount, admin, domain, intl } = this.props;
this.pages = [ this.pages = [
<PageOne acct={me.get('acct')} domain={domain} />, <PageOne acct={myAccount.get('acct')} domain={domain} />,
<PageTwo me={me} />, <PageTwo myAccount={myAccount} />,
<PageThree me={me} />, <PageThree myAccount={myAccount} />,
<PageFour domain={domain} intl={intl} />, <PageFour domain={domain} intl={intl} />,
<PageSix admin={admin} domain={domain} />, <PageSix admin={admin} domain={domain} />,
]; ];

View File

@ -4,13 +4,13 @@ import { scrollTopTimeline } from '../../../actions/timelines';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { me } from '../../../initial_state';
const makeGetStatusIds = () => createSelector([ const makeGetStatusIds = () => createSelector([
(state, { type }) => state.getIn(['settings', type], ImmutableMap()), (state, { type }) => state.getIn(['settings', type], ImmutableMap()),
(state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()), (state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()),
(state) => state.get('statuses'), (state) => state.get('statuses'),
(state) => state.getIn(['meta', 'me']), ], (columnSettings, statusIds, statuses) => {
], (columnSettings, statusIds, statuses, me) => {
const rawRegex = columnSettings.getIn(['regex', 'body'], '').trim(); const rawRegex = columnSettings.getIn(['regex', 'body'], '').trim();
let regex = null; let regex = null;

View File

@ -38,13 +38,13 @@ import {
PinnedStatuses, PinnedStatuses,
} from './util/async-components'; } from './util/async-components';
import { HotKeys } from 'react-hotkeys'; import { HotKeys } from 'react-hotkeys';
import { me } from '../../initial_state';
// Dummy import, to make sure that <Status /> ends up in the application bundle. // Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles. // Without this it ends up in ~8 very commonly used bundles.
import '../../components/status'; import '../../components/status';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
me: state.getIn(['meta', 'me']),
isComposing: state.getIn(['compose', 'is_composing']), isComposing: state.getIn(['compose', 'is_composing']),
}); });
@ -86,7 +86,6 @@ export default class UI extends React.Component {
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
children: PropTypes.node, children: PropTypes.node,
isComposing: PropTypes.bool, isComposing: PropTypes.bool,
me: PropTypes.string,
location: PropTypes.object, location: PropTypes.object,
}; };
@ -305,7 +304,7 @@ export default class UI extends React.Component {
} }
handleHotkeyGoToProfile = () => { handleHotkeyGoToProfile = () => {
this.context.router.history.push(`/accounts/${this.props.me}`); this.context.router.history.push(`/accounts/${me}`);
} }
handleHotkeyGoToBlocked = () => { handleHotkeyGoToBlocked = () => {

View File

@ -8,5 +8,6 @@ export const autoPlayGif = getMeta('auto_play_gif');
export const unfollowModal = getMeta('unfollow_modal'); export const unfollowModal = getMeta('unfollow_modal');
export const boostModal = getMeta('boost_modal'); export const boostModal = getMeta('boost_modal');
export const deleteModal = getMeta('delete_modal'); export const deleteModal = getMeta('delete_modal');
export const me = getMeta('me');
export default initialState; export default initialState;

View File

@ -31,6 +31,7 @@ import { TIMELINE_DELETE } from '../actions/timelines';
import { STORE_HYDRATE } from '../actions/store'; import { STORE_HYDRATE } from '../actions/store';
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
import uuid from '../uuid'; import uuid from '../uuid';
import { me } from '../initial_state';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
mounted: false, mounted: false,
@ -49,7 +50,6 @@ const initialState = ImmutableMap({
media_attachments: ImmutableList(), media_attachments: ImmutableList(),
suggestion_token: null, suggestion_token: null,
suggestions: ImmutableList(), suggestions: ImmutableList(),
me: null,
default_privacy: 'public', default_privacy: 'public',
default_sensitive: false, default_sensitive: false,
resetFileKey: Math.floor((Math.random() * 0x10000)), resetFileKey: Math.floor((Math.random() * 0x10000)),
@ -58,7 +58,6 @@ const initialState = ImmutableMap({
function statusToTextMentions(state, status) { function statusToTextMentions(state, status) {
let set = ImmutableOrderedSet([]); let set = ImmutableOrderedSet([]);
let me = state.get('me');
if (status.getIn(['account', 'id']) !== me) { if (status.getIn(['account', 'id']) !== me) {
set = set.add(`@${status.getIn(['account', 'acct'])} `); set = set.add(`@${status.getIn(['account', 'acct'])} `);

View File

@ -4,7 +4,6 @@ import { Map as ImmutableMap } from 'immutable';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
streaming_api_base_url: null, streaming_api_base_url: null,
access_token: null, access_token: null,
me: null,
}); });
export default function meta(state = initialState, action) { export default function meta(state = initialState, action) {