From 3a2adaa3a516c10e71729c8d64533644fab40419 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Wed, 29 Jan 2025 01:09:52 +0530 Subject: [PATCH 1/4] fixes the issue --- src/libs/ReportActionsUtils.ts | 13 ++++++++++++- src/pages/home/report/PureReportActionItem.tsx | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index e3bb3a797432..f2dbbb222a37 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -671,6 +671,16 @@ function isActionableWhisper( const {POLICY_CHANGE_LOG: policyChangelogTypes, ROOM_CHANGE_LOG: roomChangeLogTypes, ...otherActionTypes} = CONST.REPORT.ACTIONS.TYPE; const supportedActionTypes: ReportActionName[] = [...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes), ...Object.values(roomChangeLogTypes)]; +/** + * Checks whether an action is actionable track expense and resolved. + * + */ +function isResolvedActionableWhisper(reportAction: OnyxEntry): boolean { + const originalMessage = getOriginalMessage(reportAction); + const resolution = originalMessage && typeof originalMessage === 'object' && 'resolution' in originalMessage ? originalMessage?.resolution : null; + return !!resolution; +} + /** * Checks if a reportAction is fit for display, meaning that it's not deprecated, is of a valid * and supported type, it's not deleted and also not closed. @@ -720,7 +730,7 @@ function shouldReportActionBeVisible(reportAction: OnyxEntry, key: } // If action is actionable whisper and resolved by user, then we don't want to render anything - if (isActionableWhisper(reportAction) && getOriginalMessage(reportAction)?.resolution) { + if (isActionableWhisper(reportAction) && isResolvedActionableWhisper(reportAction)) { return false; } @@ -2002,6 +2012,7 @@ export { getActionableJoinRequestPendingReportAction, getReportActionsLength, wasActionCreatedWhileOffline, + isResolvedActionableWhisper, }; export type {LastVisibleMessage}; diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index e093850ec276..c9bcd32a1036 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -79,6 +79,7 @@ import { isReimbursementDeQueuedAction, isReimbursementQueuedAction, isRenamedAction, + isResolvedActionableWhisper, isTagModificationAction, isTaskAction, isTripPreview, @@ -372,6 +373,7 @@ function PureReportActionItem({ const prevDraftMessage = usePrevious(draftMessage); const isReportActionLinked = linkedReportActionID && action.reportActionID && linkedReportActionID === action.reportActionID; const isActionableWhisper = isActionableMentionWhisper(action) || isActionableTrackExpense(action) || isActionableReportMentionWhisper(action); + const isActionableWhisperResolved = isResolvedActionableWhisper(action); const highlightedBackgroundColorIfNeeded = useMemo( () => (isReportActionLinked ? StyleUtils.getBackgroundColorStyle(theme.messageHighlightBG) : {}), @@ -1105,6 +1107,9 @@ function PureReportActionItem({ const isWhisperOnlyVisibleByUser = isWhisper && isCurrentUserTheOnlyParticipant(whisperedTo); const displayNamesWithTooltips = isWhisper ? getDisplayNamesWithTooltips(whisperedToPersonalDetails, isMultipleParticipant) : []; + if (isActionableWhisper && isActionableWhisperResolved) { + return null; + } return ( Date: Wed, 29 Jan 2025 02:14:55 +0530 Subject: [PATCH 2/4] add comment for change --- src/pages/home/report/PureReportActionItem.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index c9bcd32a1036..852769160830 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -1107,9 +1107,11 @@ function PureReportActionItem({ const isWhisperOnlyVisibleByUser = isWhisper && isCurrentUserTheOnlyParticipant(whisperedTo); const displayNamesWithTooltips = isWhisper ? getDisplayNamesWithTooltips(whisperedToPersonalDetails, isMultipleParticipant) : []; + // If action is actionable whisper and resolved by user, then we don't want to render anything if (isActionableWhisper && isActionableWhisperResolved) { return null; } + return ( Date: Wed, 29 Jan 2025 16:16:55 +0530 Subject: [PATCH 3/4] fix as per suggestion --- src/pages/home/ReportScreen.tsx | 1 + src/pages/home/report/PureReportActionItem.tsx | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 7b29bef35a5a..39a670b43284 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -768,6 +768,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) { const isSingleInvoiceReport = isInvoiceReport(report) && isMostRecentReportIOU && isSingleIOUReportAction; const shouldShowMostRecentReportAction = !!mostRecentReportAction && + shouldReportActionBeVisible(mostRecentReportAction, mostRecentReportAction.reportActionID, canUserPerformWriteAction(report)) && !isSingleExpenseReport && !isSingleInvoiceReport && !isActionOfType(mostRecentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED) && diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 852769160830..e093850ec276 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -79,7 +79,6 @@ import { isReimbursementDeQueuedAction, isReimbursementQueuedAction, isRenamedAction, - isResolvedActionableWhisper, isTagModificationAction, isTaskAction, isTripPreview, @@ -373,7 +372,6 @@ function PureReportActionItem({ const prevDraftMessage = usePrevious(draftMessage); const isReportActionLinked = linkedReportActionID && action.reportActionID && linkedReportActionID === action.reportActionID; const isActionableWhisper = isActionableMentionWhisper(action) || isActionableTrackExpense(action) || isActionableReportMentionWhisper(action); - const isActionableWhisperResolved = isResolvedActionableWhisper(action); const highlightedBackgroundColorIfNeeded = useMemo( () => (isReportActionLinked ? StyleUtils.getBackgroundColorStyle(theme.messageHighlightBG) : {}), @@ -1107,11 +1105,6 @@ function PureReportActionItem({ const isWhisperOnlyVisibleByUser = isWhisper && isCurrentUserTheOnlyParticipant(whisperedTo); const displayNamesWithTooltips = isWhisper ? getDisplayNamesWithTooltips(whisperedToPersonalDetails, isMultipleParticipant) : []; - // If action is actionable whisper and resolved by user, then we don't want to render anything - if (isActionableWhisper && isActionableWhisperResolved) { - return null; - } - return ( Date: Wed, 29 Jan 2025 16:18:29 +0530 Subject: [PATCH 4/4] remove export --- src/libs/ReportActionsUtils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f2dbbb222a37..e6f9810ab336 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2012,7 +2012,6 @@ export { getActionableJoinRequestPendingReportAction, getReportActionsLength, wasActionCreatedWhileOffline, - isResolvedActionableWhisper, }; export type {LastVisibleMessage};