|
|
|
@ -5,8 +5,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
|
|
|
|
|
|
import { fetchAccount, fetchAccountByUsername } from 'soapbox/actions/accounts';
|
|
|
|
|
import { fetchAccountByUsername } from 'soapbox/actions/accounts';
|
|
|
|
|
import { fetchPatronAccount } from 'soapbox/actions/patron';
|
|
|
|
|
import { getSettings } from 'soapbox/actions/settings';
|
|
|
|
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
|
|
|
@ -67,6 +68,7 @@ const makeMapStateToProps = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default @connect(makeMapStateToProps)
|
|
|
|
|
@withRouter
|
|
|
|
|
class AccountTimeline extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
@ -82,11 +84,11 @@ class AccountTimeline extends ImmutablePureComponent {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
const { params: { username }, accountId, accountApId, withReplies, patronEnabled } = this.props;
|
|
|
|
|
const { params: { username }, accountId, accountApId, withReplies, patronEnabled, history } = this.props;
|
|
|
|
|
|
|
|
|
|
if (accountId && accountId !== -1) {
|
|
|
|
|
this.props.dispatch(fetchAccount(accountId));
|
|
|
|
|
this.props.dispatch(fetchAccountByUsername(username, history));
|
|
|
|
|
|
|
|
|
|
if (accountId && accountId !== -1) {
|
|
|
|
|
if (!withReplies) {
|
|
|
|
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
|
|
|
|
}
|
|
|
|
@ -96,17 +98,17 @@ class AccountTimeline extends ImmutablePureComponent {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.props.dispatch(expandAccountTimeline(accountId, { withReplies }));
|
|
|
|
|
} else {
|
|
|
|
|
this.props.dispatch(fetchAccountByUsername(username));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
const { params: { username }, accountId, withReplies, accountApId, patronEnabled } = this.props;
|
|
|
|
|
const { params: { username }, accountId, withReplies, accountApId, patronEnabled, history } = this.props;
|
|
|
|
|
|
|
|
|
|
if (accountId && (accountId !== -1) && (accountId !== prevProps.accountId) || withReplies !== prevProps.withReplies) {
|
|
|
|
|
this.props.dispatch(fetchAccount(accountId));
|
|
|
|
|
if (username && (username !== prevProps.params.username)) {
|
|
|
|
|
this.props.dispatch(fetchAccountByUsername(username, history));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (accountId && (accountId !== -1) && (accountId !== prevProps.accountId) || withReplies !== prevProps.withReplies) {
|
|
|
|
|
if (!withReplies) {
|
|
|
|
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
|
|
|
|
}
|
|
|
|
@ -116,8 +118,6 @@ class AccountTimeline extends ImmutablePureComponent {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.props.dispatch(expandAccountTimeline(accountId, { withReplies }));
|
|
|
|
|
} else if (username && (username !== prevProps.params.username)) {
|
|
|
|
|
this.props.dispatch(fetchAccountByUsername(username));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|