From 47489783bc58f4df449441551c254e5d5306ee71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Wed, 3 Jan 2024 22:09:51 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=E5=8F=82=E7=85=A7=E4=BB=98=E3=81=8D?= =?UTF-8?q?=E6=8A=95=E7=A8=BF=E3=81=AE=E8=A9=B3=E7=B4=B0=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=AE=E3=82=AD=E3=83=BC=E3=83=9C=E3=83=BC=E3=83=89=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=B8=8D=E5=85=B7=E5=90=88=E3=83=BB=E8=A6=8F=E5=AE=9A?= =?UTF-8?q?=E3=81=AE=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E9=87=8F?= =?UTF-8?q?=E4=B8=8D=E5=85=B7=E5=90=88=20(#409)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: 参照付き投稿の詳細画面のキーボード操作不具合・規定のスクロール量不具合 * Fix test --- .../mastodon/features/status/index.jsx | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 3de23802f5..2d42b2a542 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -580,35 +580,45 @@ class Status extends ImmutablePureComponent { }; handleMoveUp = id => { - const { status, ancestorsIds, descendantsIds } = this.props; + const { status, ancestorsIds, descendantsIds, referenceIds } = this.props; if (id === status.get('id')) { - this._selectChild(ancestorsIds.size - 1, true); + this._selectChild(ancestorsIds.size + referenceIds.size - 1, true); } else { let index = ancestorsIds.indexOf(id); if (index === -1) { index = descendantsIds.indexOf(id); - this._selectChild(ancestorsIds.size + index, true); + if (index === -1) { + index = referenceIds.indexOf(id); + this._selectChild(index - 1, true); + } else { + this._selectChild(ancestorsIds.size + referenceIds.size + index, true); + } } else { - this._selectChild(index - 1, true); + this._selectChild(referenceIds.size + index - 1, true); } } }; handleMoveDown = id => { - const { status, ancestorsIds, descendantsIds } = this.props; + const { status, ancestorsIds, descendantsIds, referenceIds } = this.props; if (id === status.get('id')) { - this._selectChild(ancestorsIds.size + 1, false); + this._selectChild(ancestorsIds.size + referenceIds.size + 1, false); } else { let index = ancestorsIds.indexOf(id); if (index === -1) { index = descendantsIds.indexOf(id); - this._selectChild(ancestorsIds.size + index + 2, false); + if (index === -1) { + index = referenceIds.indexOf(id); + this._selectChild(index + 1, false); + } else { + this._selectChild(ancestorsIds.size + referenceIds.size + index + 2, false); + } } else { - this._selectChild(index + 1, false); + this._selectChild(referenceIds.size + index + 1, false); } } }; @@ -669,9 +679,9 @@ class Status extends ImmutablePureComponent { } componentDidUpdate (prevProps) { - const { status, ancestorsIds } = this.props; + const { status, ancestorsIds, referenceIds } = this.props; - if (status && (ancestorsIds.size > prevProps.ancestorsIds.size || prevProps.status?.get('id') !== status.get('id'))) { + if (status && (ancestorsIds.size + referenceIds.size > prevProps.ancestorsIds.size + prevProps.referenceIds.size || prevProps.status?.get('id') !== status.get('id'))) { this._scrollStatusIntoView(); } }