diff options
author | Ariel <arielrodrigues@protonmail.com> | 2020-07-19 12:04:02 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-19 17:04:02 +0200 |
commit | 2ada2ae18af3429f9666fd35c70675dc62a0b99f (patch) | |
tree | d4bd1f8e13ad9a13a28801ceef14fcbec17dc0e7 /app/javascript/mastodon/features/account_timeline/index.js | |
parent | 101485a41fb2ea326496142d9ccb368522cbe0f0 (diff) |
Fix/14021 behaviour on add or remove toots (#14212)
* Add toot send by current user at local state after send a new toot Related to #14021 * Decrement toot counter at profile when remove a toot Related to #14021 * Remove semicolon at end of line
Diffstat (limited to 'app/javascript/mastodon/features/account_timeline/index.js')
-rw-r--r-- | app/javascript/mastodon/features/account_timeline/index.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/javascript/mastodon/features/account_timeline/index.js b/app/javascript/mastodon/features/account_timeline/index.js index 5ea907a1f..3846cc637 100644 --- a/app/javascript/mastodon/features/account_timeline/index.js +++ b/app/javascript/mastodon/features/account_timeline/index.js @@ -15,6 +15,8 @@ import { FormattedMessage } from 'react-intl'; import { fetchAccountIdentityProofs } from '../../actions/identity_proofs'; import MissingIndicator from 'mastodon/components/missing_indicator'; import TimelineHint from 'mastodon/components/timeline_hint'; +import { me } from 'mastodon/initial_state'; +import { connectUserTimelineStream } from '../../actions/streaming'; const emptyList = ImmutableList(); @@ -73,6 +75,12 @@ class AccountTimeline extends ImmutablePureComponent { this.props.dispatch(expandAccountTimeline(accountId, { withReplies })); } + componentDidMount () { + if (this.props.params.accountId === me) { + this.disconnect = this.props.dispatch(connectUserTimelineStream(me)); + } + } + componentWillReceiveProps (nextProps) { if ((nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) || nextProps.withReplies !== this.props.withReplies) { this.props.dispatch(fetchAccount(nextProps.params.accountId)); @@ -86,6 +94,13 @@ class AccountTimeline extends ImmutablePureComponent { } } + componentWillUnmount () { + if (this.disconnect) { + this.disconnect(); + this.disconnect = null; + } + } + handleLoadMore = maxId => { this.props.dispatch(expandAccountTimeline(this.props.params.accountId, { maxId, withReplies: this.props.withReplies })); } |