export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS';
export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL';
+import { me } from '../initial_state';
+
export function fetchPinnedStatuses() {
return (dispatch, getState) => {
dispatch(fetchPinnedStatusesRequest());
- const accountId = getState().getIn(['meta', 'me']);
- api(getState).get(`/api/v1/accounts/${accountId}/statuses`, { params: { pinned: true } }).then(response => {
+ api(getState).get(`/api/v1/accounts/${me}/statuses`, { params: { pinned: true } }).then(response => {
dispatch(fetchPinnedStatusesSuccess(response.data, null));
}).catch(error => {
dispatch(fetchPinnedStatusesFail(error));
import IconButton from './icon_button';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
+import { me } from '../initial_state';
const messages = defineMessages({
follow: { id: 'account.follow', defaultMessage: 'Follow' },
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
- me: PropTypes.string.isRequired,
onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired,
onMute: PropTypes.func.isRequired,
}
render () {
- const { account, me, intl, hidden } = this.props;
+ const { account, intl, hidden } = this.props;
if (!account) {
return <div />;
onBlock: PropTypes.func,
onEmbed: PropTypes.func,
onHeightChange: PropTypes.func,
- me: PropTypes.string,
muted: PropTypes.bool,
hidden: PropTypes.bool,
onMoveUp: PropTypes.func,
updateOnProps = [
'status',
'account',
- 'me',
'muted',
'hidden',
]
import DropdownMenuContainer from '../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
+import { me } from '../initial_state';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
onEmbed: PropTypes.func,
onMuteConversation: PropTypes.func,
onPin: PropTypes.func,
- me: PropTypes.string,
withDismiss: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
// evaluate to false. See react-immutable-pure-component for usage.
updateOnProps = [
'status',
- 'me',
'withDismiss',
]
}
render () {
- const { status, me, intl, withDismiss } = this.props;
+ const { status, intl, withDismiss } = this.props;
const mutingConversation = status.get('muted');
const anonymousAccess = !me;
const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id),
- me: state.getIn(['meta', 'me']),
});
return mapStateToProps;
const mapStateToProps = (state, props) => ({
status: getStatus(state, props.id),
- me: state.getIn(['meta', 'me']),
});
return mapStateToProps;
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { Link } from 'react-router-dom';
import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl';
+import { me } from '../../../initial_state';
const messages = defineMessages({
mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' },
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
- me: PropTypes.string.isRequired,
onFollow: PropTypes.func,
onBlock: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
}
render () {
- const { account, me, intl } = this.props;
+ const { account, intl } = this.props;
let menu = [];
let extraInfo = '';
import Motion from '../../ui/util/optional_motion';
import spring from 'react-motion/lib/spring';
import ImmutablePureComponent from 'react-immutable-pure-component';
-import { autoPlayGif } from '../../../initial_state';
+import { autoPlayGif, me } from '../../../initial_state';
const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
static propTypes = {
account: ImmutablePropTypes.map,
- me: PropTypes.string.isRequired,
onFollow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
render () {
- const { account, me, intl } = this.props;
+ const { account, intl } = this.props;
if (!account) {
return null;
static propTypes = {
account: ImmutablePropTypes.map,
- me: PropTypes.string.isRequired,
onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
}
render () {
- const { account, me } = this.props;
+ const { account } = this.props;
if (account === null) {
return <MissingIndicator />;
<div className='account-timeline__header'>
<InnerHeader
account={account}
- me={me}
onFollow={this.handleFollow}
/>
<ActionBar
account={account}
- me={me}
onBlock={this.handleBlock}
onMention={this.handleMention}
onReport={this.handleReport}
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, accountId),
- me: state.getIn(['meta', 'me']),
});
return mapStateToProps;
statusIds: state.getIn(['timelines', `account:${props.params.accountId}`, 'items'], ImmutableList()),
isLoading: state.getIn(['timelines', `account:${props.params.accountId}`, 'isLoading']),
hasMore: !!state.getIn(['timelines', `account:${props.params.accountId}`, 'next']),
- me: state.getIn(['meta', 'me']),
});
@connect(mapStateToProps)
statusIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
- me: PropTypes.string.isRequired,
};
componentWillMount () {
}
render () {
- const { statusIds, isLoading, hasMore, me } = this.props;
+ const { statusIds, isLoading, hasMore } = this.props;
if (!statusIds && isLoading) {
return (
statusIds={statusIds}
isLoading={isLoading}
hasMore={hasMore}
- me={me}
onScrollToBottom={this.handleScrollToBottom}
/>
</Column>
preselectDate: PropTypes.instanceOf(Date),
is_submitting: PropTypes.bool,
is_uploading: PropTypes.bool,
- me: PropTypes.string,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onClearSuggestions: PropTypes.func.isRequired,
preselectDate: state.getIn(['compose', 'preselectDate']),
is_submitting: state.getIn(['compose', 'is_submitting']),
is_uploading: state.getIn(['compose', 'is_uploading']),
- me: state.getIn(['compose', 'me']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
});
import { connect } from 'react-redux';
import NavigationBar from '../components/navigation_bar';
+import { me } from '../../../initial_state';
const mapStateToProps = state => {
return {
- account: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
+ account: state.getIn(['accounts', me]),
};
};
import Warning from '../components/warning';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
+import { me } from '../../../initial_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 }) => {
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' },
});
const mapStateToProps = state => ({
- me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
+ myAccount: state.getIn(['accounts', me]),
columns: state.getIn(['settings', 'columns']),
});
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 = [];
<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' />);
}
import ImmutablePropTypes from 'react-immutable-proptypes';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
+import { me } from '../../../initial_state';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
onReport: PropTypes.func,
onPin: PropTypes.func,
onEmbed: PropTypes.func,
- me: PropTypes.string.isRequired,
intl: PropTypes.object.isRequired,
};
}
render () {
- const { status, me, intl } = this.props;
+ const { status, intl } = this.props;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
status: getStatus(state, props.params.statusId),
ancestorsIds: state.getIn(['contexts', 'ancestors', props.params.statusId]),
descendantsIds: state.getIn(['contexts', 'descendants', props.params.statusId]),
- me: state.getIn(['meta', 'me']),
});
return mapStateToProps;
status: ImmutablePropTypes.map,
ancestorsIds: ImmutablePropTypes.list,
descendantsIds: ImmutablePropTypes.list,
- me: PropTypes.string,
intl: PropTypes.object.isRequired,
};
render () {
let ancestors, descendants;
- const { status, ancestorsIds, descendantsIds, me } = this.props;
+ const { status, ancestorsIds, descendantsIds } = this.props;
if (status === null) {
return (
<div className='focusable' tabIndex='0'>
<DetailedStatus
status={status}
- me={me}
onOpenVideo={this.handleOpenVideo}
onOpenMedia={this.handleOpenMedia}
/>
<ActionBar
status={status}
- me={me}
onReply={this.handleReplyClick}
onFavourite={this.handleFavouriteClick}
onReblog={this.handleReblogClick}
import NavigationBar from '../../compose/components/navigation_bar';
import ColumnHeader from './column_header';
import { List as ImmutableList } from 'immutable';
+import { me } from '../../../initial_state';
const noop = () => { };
domain: PropTypes.string.isRequired,
};
-const PageTwo = ({ me }) => (
+const PageTwo = ({ myAccount }) => (
<div className='onboarding-modal__page onboarding-modal__page-two'>
<div className='figure non-interactive'>
<div className='pseudo-drawer'>
- <NavigationBar account={me} />
+ <NavigationBar account={myAccount} />
</div>
<ComposeForm
text='Awoo! #introductions'
);
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='figure non-interactive'>
<Search
/>
<div className='pseudo-drawer'>
- <NavigationBar account={me} />
+ <NavigationBar account={myAccount} />
</div>
</div>
);
PageThree.propTypes = {
- me: ImmutablePropTypes.map.isRequired,
+ myAccount: ImmutablePropTypes.map.isRequired,
};
const PageFour = ({ domain, intl }) => (
};
const mapStateToProps = state => ({
- me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
+ myAccount: state.getIn(['accounts', me]),
admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),
domain: state.getIn(['meta', 'domain']),
});
static propTypes = {
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
- me: ImmutablePropTypes.map.isRequired,
+ myAccount: ImmutablePropTypes.map.isRequired,
domain: PropTypes.string.isRequired,
admin: ImmutablePropTypes.map,
};
};
componentWillMount() {
- const { me, admin, domain, intl } = this.props;
+ const { myAccount, admin, domain, intl } = this.props;
this.pages = [
- <PageOne acct={me.get('acct')} domain={domain} />,
- <PageTwo me={me} />,
- <PageThree me={me} />,
+ <PageOne acct={myAccount.get('acct')} domain={domain} />,
+ <PageTwo myAccount={myAccount} />,
+ <PageThree myAccount={myAccount} />,
<PageFour domain={domain} intl={intl} />,
<PageSix admin={admin} domain={domain} />,
];
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import { createSelector } from 'reselect';
import { debounce } from 'lodash';
+import { me } from '../../../initial_state';
const makeGetStatusIds = () => createSelector([
(state, { type }) => state.getIn(['settings', type], ImmutableMap()),
(state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()),
(state) => state.get('statuses'),
- (state) => state.getIn(['meta', 'me']),
-], (columnSettings, statusIds, statuses, me) => {
+], (columnSettings, statusIds, statuses) => {
const rawRegex = columnSettings.getIn(['regex', 'body'], '').trim();
let regex = null;
PinnedStatuses,
} from './util/async-components';
import { HotKeys } from 'react-hotkeys';
+import { me } from '../../initial_state';
// Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles.
import '../../components/status';
const mapStateToProps = state => ({
- me: state.getIn(['meta', 'me']),
isComposing: state.getIn(['compose', 'is_composing']),
});
dispatch: PropTypes.func.isRequired,
children: PropTypes.node,
isComposing: PropTypes.bool,
- me: PropTypes.string,
location: PropTypes.object,
};
}
handleHotkeyGoToProfile = () => {
- this.context.router.history.push(`/accounts/${this.props.me}`);
+ this.context.router.history.push(`/accounts/${me}`);
}
handleHotkeyGoToBlocked = () => {
export const unfollowModal = getMeta('unfollow_modal');
export const boostModal = getMeta('boost_modal');
export const deleteModal = getMeta('delete_modal');
+export const me = getMeta('me');
export default initialState;
import { STORE_HYDRATE } from '../actions/store';
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
import uuid from '../uuid';
+import { me } from '../initial_state';
const initialState = ImmutableMap({
mounted: false,
media_attachments: ImmutableList(),
suggestion_token: null,
suggestions: ImmutableList(),
- me: null,
default_privacy: 'public',
default_sensitive: false,
resetFileKey: Math.floor((Math.random() * 0x10000)),
function statusToTextMentions(state, status) {
let set = ImmutableOrderedSet([]);
- let me = state.get('me');
if (status.getIn(['account', 'id']) !== me) {
set = set.add(`@${status.getIn(['account', 'acct'])} `);
const initialState = ImmutableMap({
streaming_api_base_url: null,
access_token: null,
- me: null,
});
export default function meta(state = initialState, action) {