diff --git a/src/components/LHNOptionsList/OptionRowPressable.tsx b/src/components/LHNOptionsList/OptionRowPressable.tsx index d6bb4d6e0df6..e5260999184a 100644 --- a/src/components/LHNOptionsList/OptionRowPressable.tsx +++ b/src/components/LHNOptionsList/OptionRowPressable.tsx @@ -59,8 +59,6 @@ function OptionRowPressable({ report: { reportID, originalReportID: reportID, - isPinnedChat: optionItem.isPinned, - isUnreadChat: !!optionItem.isUnread, }, reportAction: { reportActionID: '-1', diff --git a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx index 23a3cc766fe4..528c5412a966 100755 --- a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -83,18 +83,9 @@ type BaseReportActionContextMenuProps = { /** Target node which is the target of ContentMenu */ anchor?: RefObject; - /** Flag to check if the chat participant is Chronos */ - isChronosReport?: boolean; - /** Whether the provided report is an archived room */ isArchivedRoom?: boolean; - /** Flag to check if the chat is pinned in the LHN. Used for the Pin/Unpin action */ - isPinnedChat?: boolean; - - /** Flag to check if the chat is unread in the LHN. Used for the Mark as Read/Unread action */ - isUnreadChat?: boolean; - /** * Is the action a thread's parent reportAction viewed from within the thread report? * It will be false if we're viewing the same parent report action from the report it belongs to rather than the thread. @@ -118,12 +109,9 @@ function BaseReportActionContextMenu({ type = CONST.CONTEXT_MENU_TYPES.REPORT_ACTION, anchor, contentRef, - isChronosReport = false, isArchivedRoom = false, isMini = false, isVisible = false, - isPinnedChat = false, - isUnreadChat = false, isThreadReportParentAction = false, selection = '', draftMessage = '', @@ -261,6 +249,9 @@ function BaseReportActionContextMenu({ isMoneyRequestOrReport && !isArchivedNonExpenseReport(transactionThreadReportID ? childReport : parentReport, transactionThreadReportID ? isChildReportArchived : isParentReportArchived); + const isChronosReport = chatIncludesChronosWithID(originalReportID); + const isPinnedChat = !!report?.isPinned; + const isUnreadChat = !report?.lastReadTime || report.lastReadTime < (report.lastVisibleActionCreated ?? ''); const shouldEnableArrowNavigation = !isMini && (isVisible || shouldKeepOpen); const isHarvestReport = isHarvestCreatedExpenseReport(reportNameValuePairs?.origin, reportNameValuePairs?.originalID); @@ -347,7 +338,6 @@ function BaseReportActionContextMenu({ reportID, originalReportID, isArchivedRoom: isArchivedNonExpenseReport(originalReport, isOriginalReportArchived), - isChronos: chatIncludesChronosWithID(originalReportID), }, reportAction: { reportActionID: reportAction?.reportActionID, diff --git a/src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx index 7730e8b655e0..ecc465ad724a 100644 --- a/src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -85,9 +85,6 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro const [shouldSetModalVisibilityForDeleteConfirmation, setShouldSetModalVisibilityForDeleteConfirmation] = useState(true); const [isRoomArchived, setIsRoomArchived] = useState(false); - const [isChronosReportEnabled, setIsChronosReportEnabled] = useState(false); - const [isChatPinned, setIsChatPinned] = useState(false); - const [hasUnreadMessages, setHasUnreadMessages] = useState(false); const [isThreadReportParentAction, setIsThreadReportParentAction] = useState(false); const [disabledActions, setDisabledActions] = useState([]); const [shouldSwitchPositionIfOverflow, setShouldSwitchPositionIfOverflow] = useState(false); @@ -182,9 +179,6 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro * @param [onShow] - Run a callback when Menu is shown * @param [onHide] - Run a callback when Menu is hidden * @param isArchivedRoom - Whether the provided report is an archived room - * @param isChronosReport - Flag to check if the chat participant is Chronos - * @param isPinnedChat - Flag to check if the chat is pinned in the LHN. Used for the Pin/Unpin action - * @param isUnreadChat - Flag to check if the chat is unread in the LHN. Used for the Mark as Read/Unread action */ const showContextMenu: ReportActionContextMenu['showContextMenu'] = (showContextMenuParams) => { cancelAnimation(hideDelayProgress); @@ -207,7 +201,7 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro setComposerToRefocusOnClose('edit'); } - const {reportID, originalReportID, isArchivedRoom = false, isChronos = false, isPinnedChat = false, isUnreadChat = false} = currentReport; + const {reportID, originalReportID, isArchivedRoom = false} = currentReport; const {reportActionID, draftMessage, isThreadReportParentAction: isThreadReportParentActionParam = false} = reportAction; const {onShow = () => {}, onHide = () => {}, setIsEmojiPickerActive = () => {}} = callbacks; setIsContextMenuOpening(true); @@ -256,9 +250,6 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro setIsPopoverVisible(true); reportActionDraftMessageRef.current = draftMessage; setIsRoomArchived(isArchivedRoom); - setIsChronosReportEnabled(isChronos); - setIsChatPinned(isPinnedChat); - setHasUnreadMessages(isUnreadChat); setIsThreadReportParentAction(isThreadReportParentActionParam); setShouldSwitchPositionIfOverflow(isOverflowMenu); }); @@ -453,9 +444,6 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro setIsDeleteCommentConfirmModalVisible(false); setShouldSetModalVisibilityForDeleteConfirmation(true); setIsRoomArchived(false); - setIsChronosReportEnabled(false); - setIsChatPinned(false); - setHasUnreadMessages(false); }; /** Opens the Confirm delete action modal */ @@ -511,9 +499,6 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro draftMessage={reportActionDraftMessageRef.current} selection={selectionRef.current} isArchivedRoom={isRoomArchived} - isChronosReport={isChronosReportEnabled} - isPinnedChat={isChatPinned} - isUnreadChat={hasUnreadMessages} isThreadReportParentAction={isThreadReportParentAction} anchor={contextMenuTargetNode} contentRef={contentRef} diff --git a/src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts b/src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts index 9aff6d7013b5..79f8be732205 100644 --- a/src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts +++ b/src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts @@ -26,9 +26,6 @@ type ShowContextMenuParams = { reportID?: string; originalReportID?: string; isArchivedRoom?: boolean; - isChronos?: boolean; - isPinnedChat?: boolean; - isUnreadChat?: boolean; }; reportAction?: { reportActionID?: string; @@ -125,9 +122,6 @@ function hideContextMenu(shouldDelay?: boolean, onHideCallback = () => {}, param * @param [onShow=() => {}] - Run a callback when Menu is shown * @param [onHide=() => {}] - Run a callback when Menu is hidden * @param isArchivedRoom - Whether the provided report is an archived room - * @param isChronosReport - Flag to check if the chat participant is Chronos - * @param isPinnedChat - Flag to check if the chat is pinned in the LHN. Used for the Pin/Unpin action - * @param isUnreadChat - Flag to check if the chat has unread messages in the LHN. Used for the Mark as Read/Unread action */ function showContextMenu(showContextMenuParams: ShowContextMenuParams) { if (!contextMenuRef.current) { diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 439341c49600..007fc77d67e4 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -216,9 +216,6 @@ type PureReportActionItemProps = { /** Whether the room is archived */ isArchivedRoom?: boolean; - /** Whether the room is a chronos report */ - isChronosReport?: boolean; - /** Function to resolve actionable report mention whisper */ resolveActionableReportMentionWhisper?: ( report: OnyxEntry, @@ -303,7 +300,6 @@ function PureReportActionItem({ originalReport, deleteReportActionDraft = () => {}, isArchivedRoom, - isChronosReport, resolveActionableReportMentionWhisper = () => {}, resolveActionableMentionWhisper = () => {}, isClosedExpenseReportWithNoExpenses, @@ -552,7 +548,6 @@ function PureReportActionItem({ reportID, originalReportID, isArchivedRoom, - isChronos: isChronosReport, }, reportAction: { reportActionID: action.reportActionID, @@ -578,7 +573,6 @@ function PureReportActionItem({ shouldDisplayContextMenuValue, disabledActions, isArchivedRoom, - isChronosReport, handleShowContextMenu, isThreadReportParentAction, ], @@ -1149,7 +1143,6 @@ function PureReportActionItem({ isVisible={hovered && draftMessage === undefined && !hasErrors} isThreadReportParentAction={isThreadReportParentAction} draftMessage={draftMessage} - isChronosReport={isChronosReport} checkIfContextMenuActive={toggleContextMenuFromActiveReportAction} setIsEmojiPickerActive={setIsEmojiPickerActive} /> @@ -1235,7 +1228,6 @@ export default memo(PureReportActionItem, (prevProps, nextProps) => { prevProps.originalReportID === nextProps.originalReportID && deepEqual(prevProps.originalReport?.participants, nextProps.originalReport?.participants) && prevProps.isArchivedRoom === nextProps.isArchivedRoom && - prevProps.isChronosReport === nextProps.isChronosReport && prevProps.isClosedExpenseReportWithNoExpenses === nextProps.isClosedExpenseReportWithNoExpenses && prevProps.userBillingFundID === nextProps.userBillingFundID && prevProps.shouldHighlight === nextProps.shouldHighlight && diff --git a/src/pages/inbox/report/ReportActionItem.tsx b/src/pages/inbox/report/ReportActionItem.tsx index e36a20b65cfe..be86324d62b0 100644 --- a/src/pages/inbox/report/ReportActionItem.tsx +++ b/src/pages/inbox/report/ReportActionItem.tsx @@ -5,7 +5,7 @@ import useOriginalReportID from '@hooks/useOriginalReportID'; import useReportIsArchived from '@hooks/useReportIsArchived'; import useReportTransactions from '@hooks/useReportTransactions'; import {getIOUReportIDFromReportActionPreview, getOriginalMessage, isMoneyRequestAction} from '@libs/ReportActionsUtils'; -import {chatIncludesChronosWithID, getTransactionsWithReceipts, isArchivedNonExpenseReport, isClosedExpenseReportWithNoExpenses} from '@libs/ReportUtils'; +import {getTransactionsWithReceipts, isArchivedNonExpenseReport, isClosedExpenseReportWithNoExpenses} from '@libs/ReportUtils'; import {clearAllRelatedReportActionErrors} from '@userActions/ClearReportActionErrors'; import {deleteReportActionDraft, resolveActionableMentionWhisper, resolveActionableReportMentionWhisper} from '@userActions/Report'; import {clearError} from '@userActions/Transaction'; @@ -73,7 +73,6 @@ function ReportActionItem({ originalReport={originalReport} deleteReportActionDraft={deleteReportActionDraft} isArchivedRoom={isArchivedNonExpenseReport(originalReport, isOriginalReportArchived)} - isChronosReport={chatIncludesChronosWithID(originalReportID)} resolveActionableReportMentionWhisper={resolveActionableReportMentionWhisper} resolveActionableMentionWhisper={resolveActionableMentionWhisper} isClosedExpenseReportWithNoExpenses={isClosedExpenseReportWithNoExpenses(iouReport, transactionsOnIOUReport)}