From eae877d0632fbcb67e5cc244cc8987d7a7a1cc63 Mon Sep 17 00:00:00 2001 From: Z Date: Tue, 5 Nov 2019 20:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E7=9A=84=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=8A=A0=E8=BD=BD=E8=AF=84=E8=AE=BA=E9=A2=84?= =?UTF-8?q?=E8=A7=88=EF=BC=8C=E7=AC=AC=E4=BA=8C=E6=AC=A1=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=89=93=E5=BC=80=E5=98=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/components/status.js | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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)}
; }