App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Report - Submit button is not displayed in second report to Approver

Open jponikarchuk opened this issue 3 weeks ago β€’ 10 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.2.79-0 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://github.com/Expensify/App/pull/76510 Email or phone of affected tester (no customers): ndk.2303+153gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Windows 11 Home/Chrome App Component: Money Requests

Action Performed:

Preconditions:

  • Owner create a workspace and invite account A and B as members. Set account A as non-admin Approver. Account B is still member
  • Member create 2 reports with 1-2 expenses in each report
  1. Open https://staging.new.expensify.com/
  2. As approver, navigate to member's workspace chat
  3. Scroll to second report
  4. Open second report
  5. Click on 'More'

Expected Result:

Approver is able to see the submit button in submitter expense report

Actual Result:

'View' is shown at second report preview. 'Submit' button disappears in More menu in report

Workaround:

Unknown

Platforms:

  • [x] Android: App
  • [ ] Android: mWeb Chrome
  • [x] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [ ] MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/36c6706d-c4d4-40de-b7cd-45e83a865ad1

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022001503863559841221
  • Upwork Job ID: 2001503863559841221
  • Last Price Increase: 2025-12-25
Issue OwnerCurrent Issue Owner: @jayeshmangwani

jponikarchuk avatar Dec 17 '25 12:12 jponikarchuk

Triggered auto assignment to @strepanier03 (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.

melvin-bot[bot] avatar Dec 17 '25 12:12 melvin-bot[bot]

Proposal

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

'View' is shown at second report preview. 'Submit' button disappears in More menu in report

What is the root cause of that problem?

When the report isn't submitted, the mangerID isn't the approver, then the check failed here

https://github.com/Expensify/App/blob/fcdbbc3d3dc33302d348a081e16ace1d127b05bf/src/libs/ReportSecondaryActionUtils.ts#L186-L189

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

We should check if the report is a the manager or not by comparing getSubmitToAccountID(policy, report) with the currentUserAccountID. We should fix the same for report preview action.

const isManager = getSubmitToAccountID(policy, report) === currentUserAccountID || report.managerID === currentUserAccountID;

https://github.com/Expensify/App/blob/fcdbbc3d3dc33302d348a081e16ace1d127b05bf/src/libs/ReportSecondaryActionUtils.ts#L186-L189

What alternative solutions did you explore? (Optional)

NA

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.

nkdengineer avatar Dec 17 '25 12:12 nkdengineer

Job added to Upwork: https://www.upwork.com/jobs/~022001503863559841221

melvin-bot[bot] avatar Dec 18 '25 04:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 18 '25 04:12 melvin-bot[bot]

Okay, reproducible on a Pixel 9 in Android: App. Sending on.

strepanier03 avatar Dec 18 '25 04:12 strepanier03

Proposal

The Submit button is not displayed in the second report because the conditional rendering logic does not correctly account for the approver role when the active report context changes.

Plan

Identify where the Submit button visibility is determined (e.g. ReportFooter / ReportActionsView)

Ensure the permission check explicitly allows approvers to submit reports in OPEN status

Verify the correct reportID and role data are read from Onyx for the second report to avoid stale state

Update the condition so the button is hidden only when submission is not permitted by role or report status

Testing

Web, iOS, Android

Confirm Submit button appears for approver on the second report

Verify successful submission and no regressions in existing report flows

I will follow the Contributor Guidelines and keep the fix minimal and regression-safe.

masimkhan1121-beep avatar Dec 18 '25 17:12 masimkhan1121-beep

πŸ“£ @masimkhan1121-beep! πŸ“£ Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Dec 18 '25 17:12 melvin-bot[bot]

@nkdengineer, I tried to repro this on the latest dev but couldn’t. Can you confirm if the issue is still reproducing for you?

jayeshmangwani avatar Dec 23 '25 12:12 jayeshmangwani

@jayeshmangwani I can reproduce on the latest main. The approver should be a non-admin approver.

Image

nkdengineer avatar Dec 24 '25 07:12 nkdengineer

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 25 '25 16:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 27 '25 00:12 melvin-bot[bot]

I’m still not able to repro this. I’ll ask if anyone on C+ can reproduce it and take this on.

https://github.com/user-attachments/assets/fc22017a-ff69-47f6-9092-e16ab511b192

jayeshmangwani avatar Dec 29 '25 05:12 jayeshmangwani

I am able to reproduce. Submit button is not displayed in non-admin approver

https://github.com/user-attachments/assets/74e926ce-1399-4cd1-9658-d28ce77b63cb

Here's config: (both are members, not admins)

Image

situchan avatar Dec 29 '25 05:12 situchan

Taking this over as C+ from https://expensify.slack.com/archives/C02NK2DQWUX/p1766985937549569

situchan avatar Dec 29 '25 05:12 situchan

@situchan From your given image, I think [email protected] also needs to be an Auditor to properly reproduce this issue and see the member's expense chat, isn't it?

Updated: In the OP steps, non-admin Approver also means account A must be Auditor

Uzaifm127 avatar Dec 30 '25 12:12 Uzaifm127

@situchan From your given image, I think [email protected] also needs to be an Auditor to properly reproduce this issue and see the member's expense chat, isn't it?

It's stated in repro step:

Set account A as non-admin Approver

situchan avatar Dec 30 '25 14:12 situchan

Proposal

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

For non admin approver: View button is displayed in Report preview instead of Submit button and Submit option isn't there when open the report and click on More button.

What is the root cause of that problem?

The root cause lies in canSubmit function in src/libs/ReportPreviewActionUtils.ts and isSubmitAction function in src/libs/ReportSecondaryActionUtils.ts.


canSubmit function is responsible to show the Submit button in Report preview in workspace chat. isSubmitAction function is responsible to show the Submit option in the dropdown of More button when opening the report.


In both functions, we are dependent on the report.managerID to choose whether to show Submit or not BUT after creating the report, report.managerID is set to the first approver and it won't be updated immediately or reflect the true current approver.

So report.managerID can be staled and these two functions uses report.managerID which leads non approver wouldn't see the Submit in either of places.

Note: When we submit the expense (neither as admin nor as approver but as a member) and retract then after retracting, the submit button is displayed to non admin approver for that retracted report.

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

We need to use getSubmitToAccountID function which dynamically calculate who should be the approver or to whom should show the Submit button.

In canSubmit function:

Remove this line (From canSubmit and isSubmitAction functions) as we will move this line to top.

const submitToAccountID = getSubmitToAccountID(policy, report);

And use getSubmitToAccountID function to comparison with currentUserAccountID

// Replace this
const isManager = report.managerID === currentUserAccountID;

// With this
const submitToAccountID = getSubmitToAccountID(policy, report);
const isManager = submitToAccountID === currentUserAccountID || report.managerID === currentUserAccountID;

In isSubmitAction function:

use getSubmitToAccountID function to comparison with getCurrentUserAccountID()

// Replace this
const isManager = report.managerID === getCurrentUserAccountID();

// With this
const submitToAccountID = getSubmitToAccountID(policy, report);
const isManager = submitToAccountID === getCurrentUserAccountID() || report.managerID === getCurrentUserAccountID();

With this way, we will also call getSubmitToAccountID only once in both functions as we removed this line:

const submitToAccountID = getSubmitToAccountID(policy, report);

Note: I've gone through the other proposals above and I found, the first proposal only fixes this issue in More dropdown not in Report preview and it calls getSubmitToAccountID twice in the same function.

With this approach, the issue will be fixed in both places.

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.

Uzaifm127 avatar Dec 30 '25 14:12 Uzaifm127

@strepanier03 , please reassign this issue to @situchan as C+

jayeshmangwani avatar Dec 31 '25 12:12 jayeshmangwani

@jayeshmangwani Sheena might be OoO till 2nd Jan, We need to wait.

Uzaifm127 avatar Dec 31 '25 12:12 Uzaifm127

@strepanier03 @jayeshmangwani this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 31 '25 21:12 melvin-bot[bot]

@situchan I think we can reassign the issue later, but feel free to move forward with the review part for now.

jayeshmangwani avatar Jan 01 '26 09:01 jayeshmangwani

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Jan 01 '26 16:01 melvin-bot[bot]

@strepanier03 Can you please reassign this issue to @situchan as C+ based on the above discussion?

Uzaifm127 avatar Jan 02 '26 17:01 Uzaifm127

@nkdengineer's proposed first. They also mentioned the fix in report preview action.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed

situchan avatar Jan 03 '26 23:01 situchan

Triggered auto assignment to @flodnv, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Jan 03 '26 23:01 melvin-bot[bot]

@situchan Thanks for the review of proposals but don't you think @nkdengineer proposal was too brief and didn't provide the clear picture.

I proposed all the places where the bug happened and provided the more comprehensive proposal.

I think we should also ask @flodnv which proposal to go.

Uzaifm127 avatar Jan 04 '26 02:01 Uzaifm127

It was clear enough for me to validate and test. The proposal doesn't need to be as detailed as PR. @Uzaifm127 to be familiar with our process, please refer to docs or other external issues where contributor was assigned.

situchan avatar Jan 04 '26 02:01 situchan

I understand your point. But the first proposal you selected was way more brief and it isn't about posting as detail as PR but a strong proposal should demonstrate the issue, root cause and solution clearly and it should be comprehensive to a certain point. A strong proposal shows the understanding of the issue of contributor.

it doesn't seems fair that a proposal with minimal effort got selected.

Let's see what @flodnv will say

Uzaifm127 avatar Jan 04 '26 08:01 Uzaifm127

Issue not reproducible during KI retests. (First week)

mvtglobally avatar Jan 04 '26 20:01 mvtglobally

πŸ“£ @situchan πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] avatar Jan 05 '26 23:01 melvin-bot[bot]