diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 4ae1bbdd6..064e9ab0d 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -108,6 +108,7 @@ class Status extends ImmutablePureComponent { showMedia: defaultMediaVisibility(this.props.status), statusId: undefined, noPreviewData: true, + noStartPD: true }; // Track height changes we know about to compensate scrolling @@ -175,16 +176,27 @@ class Status extends ImmutablePureComponent { } const { status } = this.props; + const r_status = status.get('reblog') || status; + if(this.props.com_prev && this.state.noPreviewData && r_status.get('replies_count')) { + if(this.state.noStartPD) + this.handleMouseEnter(); + return; + } this.context.router.history.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`); } handleMouseEnter = () => { - if(this.props.com_prev && this.state.noPreviewData) { - const { status } = this.props - this.props.onPreview(status.getIn(['reblog', 'id'], status.get('id'))); - this.setState({noPreviewData: false}); + const { status } = this.props; + const r_status = status.get('reblog') || status; + if(this.props.com_prev && this.state.noStartPD && r_status.get('replies_count')) { + this.setState({noStartPD: false}); + setTimeout(() => { + this.props.onPreview(r_status.get('id')); + this.setState({noPreviewData: false}); + },500); } } + handleExpandClick = (e) => { if (this.props.onClick) { this.props.onClick(); @@ -459,7 +471,7 @@ class Status extends ImmutablePureComponent { statusAvatar = ; } - if(status.get('in_reply_to_id') == null && sonsIds && sonsIds.size > 0) { + if(sonsIds && sonsIds.size > 0) { sons =
{this.renderChildren(sonsIds)}
; }