Skip to content

[Awaiting Payment][$250] Expense - Flip option is shown in confirmation page in amount section. #75304

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: V9.2.59-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1995/folder/13176670/41237103/1016710067
Email or phone of affected tester (no customers): Slottwo1 l@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13
App Component: Money Requests

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap Fab - Create expense
  3. Enter an amount
  4. Tap next
  5. Select a 1:1 user
  6. Tap amount and tap flip and change amount to negative
  7. Tap create expense
  8. Open the expense
  9. Tap amount
  10. Note expense created is not negative

Expected Result:

In step 6, flip option must not be shown in confirmation page in amount section.

Actual Result:

In step 6, flip option is shown in confirmation page in amount section.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021990456907474787796
  • Upwork Job ID: 1990456907474787796
  • Last Price Increase: 2025-11-17
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @sakluger

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 17, 2025
  2. melvin-bot commented on Nov 17, 2025

    @melvin-bot

    Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. dmkt9 commented on Nov 17, 2025

    @dmkt9
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-11-18 15:02:53 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    In step 6, flip option is shown in confirmation page in amount section.

    What is the root cause of that problem?

    1. Whether the "Flip" button is allowed to be displayed depends on the allowNegative flag:

      const allowNegative = shouldEnableNegative(report, policy, iouType);

    2. When the recipient is a user who hasn’t been chatted with before, the chat report for that user will be undefined, so isFirstTimeCreatingReport will be true:

      const isFirstTimeCreatingReport = !report && !policy && iouType === CONST.IOU.TYPE.SUBMIT;

    As a result, allowNegative will be set to true.

    What changes do you think we should make in order to solve the problem?

    For isFirstTimeCreatingReport, we need to add a condition to check the recipients.
    If the recipients include a user, then isFirstTimeCreatingReport should be false.

    App/src/libs/ReportUtils.ts

    Lines 1914 to 1916 in f34c0e3

    function shouldEnableNegative(report: OnyxEntry<Report>, policy?: OnyxEntry<Policy>, iouType?: string) {
    const isSelfDMReport = isSelfDMOrSelfDMThread(report);
    const isFirstTimeCreatingReport = !report && !policy && iouType === CONST.IOU.TYPE.SUBMIT;

    function shouldEnableNegative(report: OnyxEntry<Report>, policy?: OnyxEntry<Policy>, iouType?: string, participants?: Participant[]) {
        const isSelfDMReport = isSelfDMOrSelfDMThread(report);
    
        const isUserInRecipients = participants && participants.some((participant) => !participant.isSender && !participant.isPolicyExpenseChat && participant.accountID);
        const isFirstTimeCreatingReport = !report && !policy && iouType === CONST.IOU.TYPE.SUBMIT && !isUserInRecipients;
    

    const allowNegative = shouldEnableNegative(report, policy, iouType);

    const allowNegative = shouldEnableNegative(report, policy, iouType, transaction?.participants);
    

    What alternative solutions did you explore? (Optional)

    N/A

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 17, 2025
  5. changed the title [-]Expense - Flip option is shown in confirmation page in amount section.[/-] [+][$250] Expense - Flip option is shown in confirmation page in amount section.[/+] on Nov 17, 2025
  6. melvin-bot commented on Nov 17, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 17, 2025
  8. melvin-bot commented on Nov 17, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

  9. ShridharGoel commented on Nov 17, 2025

    @ShridharGoel
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The amount “Flip” control appears in confirmation's edit amount for 1:1 DMs, allowing negative expenses there.

    What is the root cause of that problem?

    The amount step always enables flipping whenever negatives are allowed and the flow is not a split, without excluding direct messages. There is no DM check guarding allowFlippingAmount, so the Flip button shows even in DM contexts.

    const isEditingSplitBill = isEditing && isSplitBill;
    const currentTransaction = isEditingSplitBill && !isEmptyObject(splitDraftTransaction) ? splitDraftTransaction : transaction;
    const allowNegative = shouldEnableNegative(report, policy, iouType);
    const disableOppositeConversion = isCreateAction || (isSubmitType && isSubmitAction);
    const {amount: transactionAmount} = getTransactionDetails(currentTransaction, undefined, undefined, allowNegative, disableOppositeConversion) ?? {amount: 0};
    const {currency: originalCurrency} = getTransactionDetails(isEditing && !isEmptyObject(draftTransaction) ? draftTransaction : transaction) ?? {currency: CONST.CURRENCY.USD};
    const currency = isValidCurrencyCode(selectedCurrency) ? selectedCurrency : originalCurrency;

    What changes do you think we should make in order to solve the problem?

    Add a DM guard before enabling Flip on the amount step so the control stays hidden in 1:1 chats, while still showing for self DMs (where negatives are allowed) and for workspace recipients/other allowed flows.

    Updated code:

    const isEditingSplitBill = isEditing && isSplitBill;
    const currentTransaction = isEditingSplitBill && !isEmptyObject(splitDraftTransaction) ? splitDraftTransaction : transaction;
    const allowNegative = shouldEnableNegative(report, policy, iouType);
    const disableOppositeConversion = isCreateAction || (isSubmitType && isSubmitAction);
    const {amount: transactionAmount} = getTransactionDetails(currentTransaction, undefined, undefined, allowNegative, disableOppositeConversion) ?? {amount: 0};
    const {currency: originalCurrency} = getTransactionDetails(isEditing && !isEmptyObject(draftTransaction) ? draftTransaction : transaction) ?? {currency: CONST.CURRENCY.USD};
    const currency = isValidCurrencyCode(selectedCurrency) ? selectedCurrency : originalCurrency;
    const shouldAllowFlippingAmount = !isSplitBill && allowNegative && (!isDM(report) || isSelfDM(report));
  10. Uzaifm127 commented on Nov 17, 2025

    @Uzaifm127
    Contributor

    By refering the Expected result and video attached in the issue description, I didn't get what do we actually need in final result?
    Do we need to remove the flip button on the manual amount section?
    My proposal is ready but I need some clarification about the issue and final result.

  11. shubham1206agra commented on Nov 18, 2025

    @shubham1206agra
  12. 27 remaining items

  13. sakluger commented on Dec 23, 2025

    @sakluger
    Contributor

    Payment Summary

    Contributor: @dmkt9 due $250 via Upwork: Sent offer (https://www.upwork.com/nx/wm/offer/109904759)
    Contributor+: @shubham1206agra due $250 via Newdot

  14. sakluger commented on Dec 23, 2025

    @sakluger
    Contributor

    @shubham1206agra do we need any new or updated regression tests for this one?

  15. shubham1206agra commented on Dec 23, 2025

    @shubham1206agra
    Contributor

    Test -

    1. Open App
    2. Tap Fab - Create expense
    3. Enter an amount
    4. Tap "Next"
    5. Select a 1:1 user who hasn't been chatted with yet
    6. Tap "Amount"
    7. Verify that the flip option must not be shown in the confirmation page in the amount section.
  16. dmkt9 commented on Dec 23, 2025

    @dmkt9
    Contributor

    @sakluger Thank you. Payment requested.

  17. melvin-bot commented on Dec 27, 2025

    @melvin-bot

    @sakluger Whoops! This issue is 2 days overdue. Let's get this updated quick!

  18. melvin-bot commented on Jan 1, 2026

    @melvin-bot

    @sakluger Whoops! This issue is 2 days overdue. Let's get this updated quick!

  19. sakluger commented on Jan 5, 2026

    @sakluger
    Contributor

    Thanks @dmkt9, I completed the payment.

  20. garrettmknight commented on Apr 2, 2026

    @garrettmknight
    Contributor

    $250 approved for @shubham1206agra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions