|
|
|
@ -5,6 +5,7 @@ import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { Helmet } from 'react-helmet';
|
|
|
|
import { Helmet } from 'react-helmet';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
|
|
|
|
import { difference } from 'lodash';
|
|
|
|
|
|
|
|
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
@ -150,6 +151,11 @@ class Status extends ImmutablePureComponent {
|
|
|
|
fullscreen: false,
|
|
|
|
fullscreen: false,
|
|
|
|
showMedia: defaultMediaVisibility(this.props.status),
|
|
|
|
showMedia: defaultMediaVisibility(this.props.status),
|
|
|
|
loadedStatusId: undefined,
|
|
|
|
loadedStatusId: undefined,
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Holds the ids of newly added replies, excluding the initial load.
|
|
|
|
|
|
|
|
* Used to highlight newly added replies in the UI
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
newRepliesIds: [],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UNSAFE_componentWillMount () {
|
|
|
|
UNSAFE_componentWillMount () {
|
|
|
|
@ -462,6 +468,7 @@ class Status extends ImmutablePureComponent {
|
|
|
|
previousId={i > 0 ? list[i - 1] : undefined}
|
|
|
|
previousId={i > 0 ? list[i - 1] : undefined}
|
|
|
|
nextId={list[i + 1] || (ancestors && statusId)}
|
|
|
|
nextId={list[i + 1] || (ancestors && statusId)}
|
|
|
|
rootId={statusId}
|
|
|
|
rootId={statusId}
|
|
|
|
|
|
|
|
shouldHighlightOnMount={this.state.newRepliesIds.includes(id)}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -495,11 +502,20 @@ class Status extends ImmutablePureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate (prevProps) {
|
|
|
|
componentDidUpdate (prevProps) {
|
|
|
|
const { status, ancestorsIds } = this.props;
|
|
|
|
const { status, ancestorsIds, descendantsIds } = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
if (status && (ancestorsIds.length > prevProps.ancestorsIds.length || prevProps.status?.get('id') !== status.get('id'))) {
|
|
|
|
if (status && (ancestorsIds.length > prevProps.ancestorsIds.length || prevProps.status?.get('id') !== status.get('id'))) {
|
|
|
|
this._scrollStatusIntoView();
|
|
|
|
this._scrollStatusIntoView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Only highlight replies after the initial load
|
|
|
|
|
|
|
|
if (prevProps.descendantsIds.length) {
|
|
|
|
|
|
|
|
const newRepliesIds = difference(descendantsIds, prevProps.descendantsIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (newRepliesIds.length) {
|
|
|
|
|
|
|
|
this.setState({newRepliesIds});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount () {
|
|
|
|
componentWillUnmount () {
|
|
|
|
|