From 4fe3878d04c38b0d16849d9aac1ae85a7a8c1c4e Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Fri, 26 Jan 2024 05:08:03 +0700 Subject: [PATCH 1/4] fix hide join button once leaving --- src/pages/home/HeaderView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 2a98a50552be..ad387127ef41 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -155,7 +155,7 @@ function HeaderView(props) { ); const canJoinOrLeave = isChatThread || isUserCreatedPolicyRoom || canLeaveRoom; - const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; + const canJoin = props.report.reportID && canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; const canLeave = canJoinOrLeave && ((isChatThread && props.report.notificationPreference.length) || isUserCreatedPolicyRoom || canLeaveRoom); if (canJoin) { threeDotMenuItems.push({ @@ -217,7 +217,7 @@ function HeaderView(props) { const shouldShowBorderBottom = !isTaskReport || !isSmallScreenWidth; const shouldDisableDetailPage = ReportUtils.shouldDisableDetailPage(props.report); - const isLoading = !props.report || !title; + const isLoading = !props.report.reportID || !props.report || !title; return ( Date: Fri, 26 Jan 2024 05:22:22 +0700 Subject: [PATCH 2/4] fix: issue --- src/pages/home/HeaderView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index ad387127ef41..36a72d40ffae 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -155,7 +155,7 @@ function HeaderView(props) { ); const canJoinOrLeave = isChatThread || isUserCreatedPolicyRoom || canLeaveRoom; - const canJoin = props.report.reportID && canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; + const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN && props.report && props.report.reportID; const canLeave = canJoinOrLeave && ((isChatThread && props.report.notificationPreference.length) || isUserCreatedPolicyRoom || canLeaveRoom); if (canJoin) { threeDotMenuItems.push({ @@ -217,7 +217,7 @@ function HeaderView(props) { const shouldShowBorderBottom = !isTaskReport || !isSmallScreenWidth; const shouldDisableDetailPage = ReportUtils.shouldDisableDetailPage(props.report); - const isLoading = !props.report.reportID || !props.report || !title; + const isLoading = !props.report || !title || !props.report.reportID; return ( Date: Sat, 27 Jan 2024 11:50:30 +0700 Subject: [PATCH 3/4] fix add isLoading to render condition of join button --- src/pages/home/HeaderView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 36a72d40ffae..726f809805c2 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -155,7 +155,7 @@ function HeaderView(props) { ); const canJoinOrLeave = isChatThread || isUserCreatedPolicyRoom || canLeaveRoom; - const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN && props.report && props.report.reportID; + const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; const canLeave = canJoinOrLeave && ((isChatThread && props.report.notificationPreference.length) || isUserCreatedPolicyRoom || canLeaveRoom); if (canJoin) { threeDotMenuItems.push({ @@ -217,7 +217,7 @@ function HeaderView(props) { const shouldShowBorderBottom = !isTaskReport || !isSmallScreenWidth; const shouldDisableDetailPage = ReportUtils.shouldDisableDetailPage(props.report); - const isLoading = !props.report || !title || !props.report.reportID; + const isLoading = !props.report || !props.report.reportID || !title; return ( - {canJoin && isSmallScreenWidth && {joinButton}} + {isLoading && canJoin && isSmallScreenWidth && {joinButton}} ); } From 76d4e473f9d449b934622d85bfcd0c6799b79567 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Sat, 27 Jan 2024 11:55:29 +0700 Subject: [PATCH 4/4] fix issue --- src/pages/home/HeaderView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 726f809805c2..e0f6ed71d8f5 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -321,7 +321,7 @@ function HeaderView(props) { )} - {isLoading && canJoin && isSmallScreenWidth && {joinButton}} + {!isLoading && canJoin && isSmallScreenWidth && {joinButton}} ); }