Stop verify_credentials infinite loop, partial fix for #613
This commit is contained in:
parent
205926f34b
commit
7a19861ac6
|
@ -17,7 +17,7 @@ import { makeGetAccount } from '../selectors';
|
||||||
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
||||||
import ThemeToggle from '../features/ui/components/theme_toggle_container';
|
import ThemeToggle from '../features/ui/components/theme_toggle_container';
|
||||||
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
||||||
import { List as ImmutableList } from 'immutable';
|
import { List as ImmutableList, is as ImmutableIs } from 'immutable';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
||||||
|
@ -63,7 +63,6 @@ const mapStateToProps = state => {
|
||||||
donateUrl: state.getIn(['patron', 'instance', 'url']),
|
donateUrl: state.getIn(['patron', 'instance', 'url']),
|
||||||
isStaff: isStaff(state.getIn(['accounts', me])),
|
isStaff: isStaff(state.getIn(['accounts', me])),
|
||||||
otherAccounts,
|
otherAccounts,
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,6 +89,7 @@ class SidebarMenu extends ImmutablePureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
account: ImmutablePropTypes.map,
|
account: ImmutablePropTypes.map,
|
||||||
|
otherAccounts: ImmutablePropTypes.list,
|
||||||
sidebarOpen: PropTypes.bool,
|
sidebarOpen: PropTypes.bool,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
isStaff: PropTypes.bool.isRequired,
|
isStaff: PropTypes.bool.isRequired,
|
||||||
|
@ -128,8 +128,13 @@ class SidebarMenu extends ImmutablePureComponent {
|
||||||
this.fetchOwnAccounts();
|
this.fetchOwnAccounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate(prevProps) {
|
||||||
this.fetchOwnAccounts();
|
const accountChanged = !ImmutableIs(prevProps.account, this.props.account);
|
||||||
|
const otherAccountsChanged = !ImmutableIs(prevProps.otherAccounts, this.props.otherAccounts);
|
||||||
|
|
||||||
|
if (accountChanged || otherAccountsChanged) {
|
||||||
|
this.fetchOwnAccounts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderAccount = account => {
|
renderAccount = account => {
|
||||||
|
|
|
@ -8,7 +8,7 @@ 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 { List as ImmutableList } from 'immutable';
|
import { List as ImmutableList, is as ImmutableIs } from 'immutable';
|
||||||
import Avatar from 'soapbox/components/avatar';
|
import Avatar from 'soapbox/components/avatar';
|
||||||
import DisplayName from 'soapbox/components/display_name';
|
import DisplayName from 'soapbox/components/display_name';
|
||||||
|
|
||||||
|
@ -80,8 +80,13 @@ class ProfileDropdown extends React.PureComponent {
|
||||||
this.fetchOwnAccounts();
|
this.fetchOwnAccounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate(prevProps) {
|
||||||
this.fetchOwnAccounts();
|
const accountChanged = !ImmutableIs(prevProps.account, this.props.account);
|
||||||
|
const otherAccountsChanged = !ImmutableIs(prevProps.otherAccounts, this.props.otherAccounts);
|
||||||
|
|
||||||
|
if (accountChanged || otherAccountsChanged) {
|
||||||
|
this.fetchOwnAccounts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderAccount = account => {
|
renderAccount = account => {
|
||||||
|
|
|
@ -24,6 +24,7 @@ const initialState = ImmutableMap();
|
||||||
const normalizePleroma = account => {
|
const normalizePleroma = account => {
|
||||||
if (!account.pleroma) return account;
|
if (!account.pleroma) return account;
|
||||||
account.pleroma = normalizePleromaUserFields(account.pleroma);
|
account.pleroma = normalizePleromaUserFields(account.pleroma);
|
||||||
|
delete account.pleroma.chat_token;
|
||||||
return account;
|
return account;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue