Skip to content

Commit

Permalink
Merge pull request #50331 from FitseTLT/fix-submit-to-someone-for-dis…
Browse files Browse the repository at this point in the history
…abled-p2p-beta

Fix - Track - User appears with offline avatar on Submit expense page for distance request
  • Loading branch information
MariaHCD authored Oct 11, 2024
2 parents b7c1e1e + 6ca4085 commit 285bde8
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {ShowContextMenuContext} from '@components/ShowContextMenuContext';
import Text from '@components/Text';
import UnreadActionIndicator from '@components/UnreadActionIndicator';
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import usePrevious from '@hooks/usePrevious';
import useReportScrollManager from '@hooks/useReportScrollManager';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand All @@ -52,6 +53,7 @@ import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import SelectionScraper from '@libs/SelectionScraper';
import shouldRenderAddPaymentCard from '@libs/shouldRenderAppPaymentCard';
import * as TransactionUtils from '@libs/TransactionUtils';
import {ReactionListContext} from '@pages/home/ReportScreenContext';
import * as BankAccounts from '@userActions/BankAccounts';
import * as EmojiPickerAction from '@userActions/EmojiPickerAction';
Expand Down Expand Up @@ -195,6 +197,7 @@ function ReportActionItem({
const popoverAnchorRef = useRef<Exclude<ReportActionContextMenu.ContextMenuAnchor, TextInput>>(null);
const downloadedPreviews = useRef<string[]>([]);
const prevDraftMessage = usePrevious(draftMessage);
const {canUseP2PDistanceRequests} = usePermissions();

// The app would crash due to subscribing to the entire report collection if parentReportID is an empty string. So we should have a fallback ID here.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down Expand Up @@ -418,14 +421,18 @@ function ReportActionItem({
if (ReportActionsUtils.isActionableTrackExpense(action)) {
const transactionID = ReportActionsUtils.getOriginalMessage(action)?.transactionID;
return [
{
text: 'actionableMentionTrackExpense.submit',
key: `${action.reportActionID}-actionableMentionTrackExpense-submit`,
onPress: () => {
ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(transactionID ?? '0', reportID, CONST.IOU.ACTION.SUBMIT, action.reportActionID);
},
isMediumSized: true,
},
...(!TransactionUtils.isDistanceRequest(TransactionUtils.getTransaction(transactionID ?? '-1')) || canUseP2PDistanceRequests
? [
{
text: 'actionableMentionTrackExpense.submit',
key: `${action.reportActionID}-actionableMentionTrackExpense-submit`,
onPress: () => {
ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(transactionID ?? '0', reportID, CONST.IOU.ACTION.SUBMIT, action.reportActionID);
},
isMediumSized: true,
} as ActionableItem,
]
: []),
{
text: 'actionableMentionTrackExpense.categorize',
key: `${action.reportActionID}-actionableMentionTrackExpense-categorize`,
Expand Down Expand Up @@ -498,7 +505,7 @@ function ReportActionItem({
onPress: () => Report.resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.NOTHING),
},
];
}, [action, isActionableWhisper, reportID]);
}, [action, isActionableWhisper, reportID, canUseP2PDistanceRequests]);

/**
* Get the content of ReportActionItem
Expand Down

0 comments on commit 285bde8

Please sign in to comment.