|
|
@ -16,7 +16,7 @@ import { fetchAccountIdentityProofs } from '../../actions/identity_proofs';
|
|
|
|
import MissingIndicator from 'mastodon/components/missing_indicator';
|
|
|
|
import MissingIndicator from 'mastodon/components/missing_indicator';
|
|
|
|
import TimelineHint from 'mastodon/components/timeline_hint';
|
|
|
|
import TimelineHint from 'mastodon/components/timeline_hint';
|
|
|
|
import { me } from 'mastodon/initial_state';
|
|
|
|
import { me } from 'mastodon/initial_state';
|
|
|
|
import { connectUserTimelineStream } from '../../actions/streaming';
|
|
|
|
import { connectTimeline, disconnectTimeline } from 'mastodon/actions/timelines';
|
|
|
|
|
|
|
|
|
|
|
|
const emptyList = ImmutableList();
|
|
|
|
const emptyList = ImmutableList();
|
|
|
|
|
|
|
|
|
|
|
@ -63,41 +63,48 @@ class AccountTimeline extends ImmutablePureComponent {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
componentWillMount () {
|
|
|
|
componentWillMount () {
|
|
|
|
const { params: { accountId }, withReplies } = this.props;
|
|
|
|
const { params: { accountId }, withReplies, dispatch } = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
this.props.dispatch(fetchAccount(accountId));
|
|
|
|
dispatch(fetchAccount(accountId));
|
|
|
|
this.props.dispatch(fetchAccountIdentityProofs(accountId));
|
|
|
|
dispatch(fetchAccountIdentityProofs(accountId));
|
|
|
|
|
|
|
|
|
|
|
|
if (!withReplies) {
|
|
|
|
if (!withReplies) {
|
|
|
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
|
|
|
dispatch(expandAccountFeaturedTimeline(accountId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.props.dispatch(expandAccountTimeline(accountId, { withReplies }));
|
|
|
|
dispatch(expandAccountTimeline(accountId, { withReplies }));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount () {
|
|
|
|
if (accountId === me) {
|
|
|
|
if (this.props.params.accountId === me) {
|
|
|
|
dispatch(connectTimeline(`account:${me}`));
|
|
|
|
this.disconnect = this.props.dispatch(connectUserTimelineStream(me));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps (nextProps) {
|
|
|
|
componentWillReceiveProps (nextProps) {
|
|
|
|
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
if ((nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) || nextProps.withReplies !== this.props.withReplies) {
|
|
|
|
if ((nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) || nextProps.withReplies !== this.props.withReplies) {
|
|
|
|
this.props.dispatch(fetchAccount(nextProps.params.accountId));
|
|
|
|
dispatch(fetchAccount(nextProps.params.accountId));
|
|
|
|
this.props.dispatch(fetchAccountIdentityProofs(nextProps.params.accountId));
|
|
|
|
dispatch(fetchAccountIdentityProofs(nextProps.params.accountId));
|
|
|
|
|
|
|
|
|
|
|
|
if (!nextProps.withReplies) {
|
|
|
|
if (!nextProps.withReplies) {
|
|
|
|
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.params.accountId));
|
|
|
|
dispatch(expandAccountFeaturedTimeline(nextProps.params.accountId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.props.dispatch(expandAccountTimeline(nextProps.params.accountId, { withReplies: nextProps.params.withReplies }));
|
|
|
|
dispatch(expandAccountTimeline(nextProps.params.accountId, { withReplies: nextProps.params.withReplies }));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (nextProps.params.accountId === me && this.props.params.accountId !== me) {
|
|
|
|
|
|
|
|
dispatch(connectTimeline(`account:${me}`));
|
|
|
|
|
|
|
|
} else if (this.props.params.accountId === me && nextProps.params.accountId !== me) {
|
|
|
|
|
|
|
|
dispatch(disconnectTimeline(`account:${me}`));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount () {
|
|
|
|
componentWillUnmount () {
|
|
|
|
if (this.disconnect) {
|
|
|
|
const { dispatch, params: { accountId } } = this.props;
|
|
|
|
this.disconnect();
|
|
|
|
|
|
|
|
this.disconnect = null;
|
|
|
|
if (accountId === me) {
|
|
|
|
|
|
|
|
dispatch(disconnectTimeline(`account:${me}`));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|