From 05ca9610bec77eeea9ba58b4171a938727ace62a Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 28 Feb 2024 16:22:02 +0700 Subject: [PATCH 1/2] Fix display name displays twice on LHN after receiving payment --- src/libs/SidebarUtils.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 35cf52a5ff99..d8b0ed90309e 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -289,14 +289,12 @@ function getOptionData({ let lastMessageText = lastMessageTextFromReport; - const reportAction = lastReportActions?.[report.reportID]; + const lastAction = visibleReportActionItems[report.reportID]; const isThreadMessage = - ReportUtils.isThread(report) && reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && reportAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; + ReportUtils.isThread(report) && lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && lastAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport || isThreadMessage) && !result.isArchivedRoom) { - const lastAction = visibleReportActionItems[report.reportID]; - if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) { const newName = lastAction?.originalMessage?.newName ?? ''; result.alternateText = Localize.translate(preferredLocale, 'newRoomPage.roomRenamedTo', {newName}); From 2419ba6a0a3aa7bc85dada219f5d0af336c12a5e Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 28 Feb 2024 17:49:50 +0700 Subject: [PATCH 2/2] remove unused variable --- src/libs/SidebarUtils.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index d8b0ed90309e..299becd45515 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -23,7 +23,6 @@ import * as TaskUtils from './TaskUtils'; import * as UserUtils from './UserUtils'; const visibleReportActionItems: ReportActions = {}; -const lastReportActions: ReportActions = {}; Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, @@ -34,7 +33,6 @@ Onyx.connect({ const reportID = CollectionUtils.extractCollectionItemID(key); const actionsArray: ReportAction[] = ReportActionsUtils.getSortedReportActions(Object.values(actions)); - lastReportActions[reportID] = actionsArray[actionsArray.length - 1]; // The report is only visible if it is the last action not deleted that // does not match a closed or created state.