|
|
@ -1,13 +1,14 @@
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
// import { openModal } from '../../../actions/modal';
|
|
|
|
// import { openModal } from '../../../actions/modal';
|
|
|
|
|
|
|
|
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
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 { isStaff } from 'soapbox/utils/accounts';
|
|
|
|
import { isStaff } from 'soapbox/utils/accounts';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
|
|
|
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
|
|
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
|
|
|
import { List as ImmutableList } from 'immutable';
|
|
|
|
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
const messages = defineMessages({
|
|
|
|
switch: { id: 'profile_dropdown.switch_account', defaultMessage: 'Switch to @{acct}' },
|
|
|
|
switch: { id: 'profile_dropdown.switch_account', defaultMessage: 'Switch to @{acct}' },
|
|
|
@ -23,8 +24,8 @@ const mapStateToProps = state => {
|
|
|
|
.keySeq()
|
|
|
|
.keySeq()
|
|
|
|
.reduce((list, id) => {
|
|
|
|
.reduce((list, id) => {
|
|
|
|
if (id === me) return list;
|
|
|
|
if (id === me) return list;
|
|
|
|
const account = state.getIn(['accounts', id]) || ImmutableMap({ id: id, acct: id });
|
|
|
|
const account = state.getIn(['accounts', id]);
|
|
|
|
return list.push(account);
|
|
|
|
return account ? list.push(account) : list;
|
|
|
|
}, ImmutableList());
|
|
|
|
}, ImmutableList());
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -61,6 +62,14 @@ class ProfileDropdown extends React.PureComponent {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
this.props.dispatch(fetchOwnAccounts());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
|
|
|
|
this.props.dispatch(fetchOwnAccounts());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const { intl, account, otherAccounts } = this.props;
|
|
|
|
const { intl, account, otherAccounts } = this.props;
|
|
|
|
const size = this.props.size || 16;
|
|
|
|
const size = this.props.size || 16;
|
|
|
|