Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/components/LHNOptionsList/OptionRowPressable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ function OptionRowPressable({
report: {
reportID,
originalReportID: reportID,
isPinnedChat: optionItem.isPinned,
isUnreadChat: !!optionItem.isUnread,
},
reportAction: {
reportActionID: '-1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,9 @@ type BaseReportActionContextMenuProps = {
/** Target node which is the target of ContentMenu */
anchor?: RefObject<ContextMenuAnchor>;

/** 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.
Expand All @@ -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 = '',
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -347,7 +338,6 @@ function BaseReportActionContextMenu({
reportID,
originalReportID,
isArchivedRoom: isArchivedNonExpenseReport(originalReport, isOriginalReportArchived),
isChronos: chatIncludesChronosWithID(originalReportID),
},
reportAction: {
reportActionID: reportAction?.reportActionID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContextMenuAction[]>([]);
const [shouldSwitchPositionIfOverflow, setShouldSwitchPositionIfOverflow] = useState(false);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ type ShowContextMenuParams = {
reportID?: string;
originalReportID?: string;
isArchivedRoom?: boolean;
isChronos?: boolean;
isPinnedChat?: boolean;
isUnreadChat?: boolean;
};
reportAction?: {
reportActionID?: string;
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 0 additions & 8 deletions src/pages/inbox/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<OnyxTypes.Report>,
Expand Down Expand Up @@ -303,7 +300,6 @@ function PureReportActionItem({
originalReport,
deleteReportActionDraft = () => {},
isArchivedRoom,
isChronosReport,
resolveActionableReportMentionWhisper = () => {},
resolveActionableMentionWhisper = () => {},
isClosedExpenseReportWithNoExpenses,
Expand Down Expand Up @@ -552,7 +548,6 @@ function PureReportActionItem({
reportID,
originalReportID,
isArchivedRoom,
isChronos: isChronosReport,
},
reportAction: {
reportActionID: action.reportActionID,
Expand All @@ -578,7 +573,6 @@ function PureReportActionItem({
shouldDisplayContextMenuValue,
disabledActions,
isArchivedRoom,
isChronosReport,
handleShowContextMenu,
isThreadReportParentAction,
],
Expand Down Expand Up @@ -1149,7 +1143,6 @@ function PureReportActionItem({
isVisible={hovered && draftMessage === undefined && !hasErrors}
isThreadReportParentAction={isThreadReportParentAction}
draftMessage={draftMessage}
isChronosReport={isChronosReport}
checkIfContextMenuActive={toggleContextMenuFromActiveReportAction}
setIsEmojiPickerActive={setIsEmojiPickerActive}
/>
Expand Down Expand Up @@ -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 &&
Expand Down
3 changes: 1 addition & 2 deletions src/pages/inbox/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)}
Expand Down
Loading