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

[CP Staging] Remove checks for IOU #44357

Merged
merged 2 commits into from
Jun 25, 2024
Merged
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
12 changes: 5 additions & 7 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2170,10 +2170,11 @@ function getDeletedParentActionMessageForChatReport(reportAction: OnyxEntry<Repo
/**
* Returns the preview message for `REIMBURSEMENT_QUEUED` action
*/
function getReimbursementQueuedActionMessage(reportAction: OnyxEntry<ReportAction>, reportOrID: OnyxEntry<Report> | string, shouldUseShortDisplayName = true): string {
if (!ReportActionsUtils.isMoneyRequestAction(reportAction)) {
return '';
}
function getReimbursementQueuedActionMessage(
reportAction: OnyxEntry<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_QUEUED>>,
reportOrID: OnyxEntry<Report> | string,
shouldUseShortDisplayName = true,
): string {
const report = typeof reportOrID === 'string' ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] : reportOrID;
const submitterDisplayName = getDisplayNameForParticipant(report?.ownerAccountID, shouldUseShortDisplayName) ?? '';
const originalMessage = ReportActionsUtils.getOriginalMessage(reportAction);
Expand All @@ -2195,9 +2196,6 @@ function getReimbursementDeQueuedActionMessage(
reportOrID: OnyxEntry<Report> | EmptyObject | string,
isLHNPreview = false,
): string {
if (!ReportActionsUtils.isReimbursementDeQueuedAction(reportAction)) {
return '';
}
const report = typeof reportOrID === 'string' ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] : reportOrID;
Comment on lines -2198 to 2199
Copy link
Contributor Author

@aldo-expensify aldo-expensify Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add this kind of check if we have types that will complain when we call these functions with the wrong reportAction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everywhere we call this function we check with ReportActionsUtils.isReimbursementDeQueuedAction before calling it.

const originalMessage = ReportActionsUtils.getOriginalMessage(reportAction);
const amount = originalMessage?.amount;
Expand Down
Loading