Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Track expense - Concierge message appears in self DM after deleting track expense #55895

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReportAction>): 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.
Expand Down Expand Up @@ -720,7 +730,7 @@ function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, 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;
}

Expand Down Expand Up @@ -2002,6 +2012,7 @@ export {
getActionableJoinRequestPendingReportAction,
getReportActionsLength,
wasActionCreatedWhileOffline,
isResolvedActionableWhisper,
};

export type {LastVisibleMessage};
5 changes: 5 additions & 0 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import {
isReimbursementDeQueuedAction,
isReimbursementQueuedAction,
isRenamedAction,
isResolvedActionableWhisper,
isTagModificationAction,
isTaskAction,
isTripPreview,
Expand Down Expand Up @@ -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) : {}),
Expand Down Expand Up @@ -1105,6 +1107,9 @@ function PureReportActionItem({
const isWhisperOnlyVisibleByUser = isWhisper && isCurrentUserTheOnlyParticipant(whisperedTo);
const displayNamesWithTooltips = isWhisper ? getDisplayNamesWithTooltips(whisperedToPersonalDetails, isMultipleParticipant) : [];

if (isActionableWhisper && isActionableWhisperResolved) {
ishpaul777 marked this conversation as resolved.
Show resolved Hide resolved
return null;
}
return (
<PressableWithSecondaryInteraction
ref={popoverAnchorRef}
Expand Down
Loading