Skip to content

[Due for payment 2025-11-17] [$250] Distance - Employee is not able to edit distance expense amount, when the admin can do it #71792

Closed

Description

@vincdargento

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: 9.2.22-4
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: MacBook Air 15.6.1 Chrome, iPhone 15 iOS 18.5 Safari
App Component: Money Requests
Slack conversation: https://expensify.slack.com/archives/C9YU7BX5M/p1759239943371959

Action Performed:

  1. Admin, invite Employee to the workspace
  2. Employee, create a distance map expense, entering valid waypoints (Track distance - Map)
  3. Employee - open the expense details, try to edit the amount
  4. Admin, open the expense details, try to edit the amount

Expected Result:

Employee should be able to edit distance expense amount

Actual Result:

Employee is not able to edit distance expense amount, the field is not clickable

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

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021973890434035325934
  • Upwork Job ID: 1973890434035325934
  • Last Price Increase: 2025-10-02
  • Automatic offers:
    • FitseTLT | Contributor | 109080941
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @trjExpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @alexpensify (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. m-natarajan commented on Oct 2, 2025

    @m-natarajan

    Discussed more about this issue here

  4. FitseTLT commented on Oct 2, 2025

    @FitseTLT
    Contributor

    Proposal

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

    Distance - Employee is not able to edit distance expense amount, when the admin can do it

    What is the root cause of that problem?

    We are not allowing the requestor to edit amount here

    App/src/libs/ReportUtils.ts

    Lines 4349 to 4350 in 3262b4b

    if ((fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) && isDistanceRequest(transaction)) {
    return isAdmin || isManager;

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

    We should allow isRequestor

     return isAdmin || isManager || isRequestor;
    

    But currently the BE UpdateMoneyRequestAmountAndCurrency is returning error for the requestor so BE change should be made to allow the requestor edit amount.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    Test canEditFieldOfMoneyRequest for the change to assert it returns true for the requestor when it is distance request for amount and currency fields.

    What alternative solutions did you explore? (Optional)

  5. paulnjs commented on Oct 2, 2025

    @paulnjs
    Contributor

    Proposal

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

    Employee is not able to edit distance expense amount, the field is not clickable

    What is the root cause of that problem?

    For the amount field of distance request, we return true if the user is admin/manager

    |

    App/src/libs/ReportUtils.ts

    Lines 4349 to 4355 in c9c52b9

    if ((fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) && isDistanceRequest(transaction)) {
    return isAdmin || isManager;
    }
    if (
    (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY || fieldToEdit === CONST.EDIT_REQUEST_FIELD.MERCHANT) &&
    isPerDiemRequest(transaction)

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

    The amount of distance request shouldn't be editable since it's calculated based on the distance and rate then we should return false here

    if ((fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) && isDistanceRequest(transaction)) {
        return isAdmin || isManager;
    }
    

    |

    App/src/libs/ReportUtils.ts

    Lines 4349 to 4355 in c9c52b9

    if ((fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) && isDistanceRequest(transaction)) {
    return isAdmin || isManager;
    }
    if (
    (fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY || fieldToEdit === CONST.EDIT_REQUEST_FIELD.MERCHANT) &&
    isPerDiemRequest(transaction)

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can add a test case for canEditFieldOfMoneyRequest function to verify it returns false for the amount field of distance request even if the user is admin/mananger

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. trjExpensify commented on Oct 2, 2025

    @trjExpensify
    Contributor

    But currently the BE UpdateMoneyRequestAmountAndCurrency is returning error for the requestor so BE change should be made to allow the requestor edit amount.

    Ah yeah, you're right. We need to allow the amount to be changed here:

    https://github.com/Expensify/Auth/blob/0f2e0547b9f5d669baeae4c87c24939479528fd6/auth/command/UpdateMoneyRequestAmountAndCurrency.cpp#L95-L100

    So we'll need a combo of front-end and back-end for this @neil-marcellini.

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 2, 2025
  8. melvin-bot commented on Oct 2, 2025

    @melvin-bot
  9. changed the title [-]Distance - Employee is not able to edit distance expense amount, when the admin can do it[/-] [+][$250] Distance - Employee is not able to edit distance expense amount, when the admin can do it[/+] on Oct 2, 2025
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 2, 2025
  11. 31 remaining items

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Nov 10, 2025
  13. changed the title [-][$250] Distance - Employee is not able to edit distance expense amount, when the admin can do it[/-] [+][Due for payment 2025-11-17] [$250] Distance - Employee is not able to edit distance expense amount, when the admin can do it[/+] on Nov 10, 2025
  14. melvin-bot commented on Nov 10, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Nov 10, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.47-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-11-17. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Nov 10, 2025

    @melvin-bot

    @FitseTLT / @brunovjk @trjExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. trjExpensify commented on Nov 17, 2025

    @trjExpensify
    Contributor

    👋 checklist time, @brunovjk!

  18. brunovjk commented on Nov 17, 2025

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: No PR directly introduced this bug.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Test:

    1. Admin, invite Employee to the workspace
    2. Employee, create a distance map expense, entering valid waypoints (Track distance - Map)
    3. Employee - open the expense details, try to edit the amount
    4. Verify it is editable.

    Do we agree 👍 or 👎

  19. trjExpensify commented on Nov 21, 2025

    @trjExpensify
    Contributor

    This should be swept up in create expense flows.

    Payment summary as follows:

  20. moved this from MEDIUM or LOW to Done in [#whatsnext] #migrateon Nov 21, 2025
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 contributorInternalRequires API changes or must be handled by Expensify staff

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions