App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Invoices - Invoice title is not changed after it is renamed

Open IuliiaHerets opened this issue 1 year ago • 5 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: 9.0.72-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both If this was caught during regression testing, add the test name, ID and link from TestRail: Exp https://expensify.testrail.io/index.php?/tests/view/5310233 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team

Action Performed:

Precondtion:

  • Invoices are enabled.
  1. Go to staging.new.expensify.com
  2. Go to FAB > Send invoice.
  3. Send an invoice to anyone.
  4. In invoice room, click on the invoice preview.
  5. Click on the report title.
  6. Click on the invoice title.
  7. Rename and save it.

Expected Result:

The invoice title should be changed.

Actual Result:

The invoice title is not changed after it is renamed.

Workaround:

Unknown

Platforms:

  • [x] Android: Standalone
  • [x] Android: HybridApp
  • [x] Android: mWeb Chrome
  • [x] iOS: Standalone
  • [x] iOS: HybridApp
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/32355218-963c-492c-aebe-bebc61fe6879

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021865017078260739311
  • Upwork Job ID: 1865017078260739311
  • Last Price Increase: 2024-12-06
Issue OwnerCurrent Issue Owner: @hungvu193

IuliiaHerets avatar Dec 06 '24 10:12 IuliiaHerets

Triggered auto assignment to @twisterdotcom (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 06 '24 10:12 melvin-bot[bot]

Proposal

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

Invoice title is not changed after it is renamed

What is the root cause of that problem?

We call getMoneyRequestReportName when getting report name for a invoice report: https://github.com/Expensify/App/blob/2dcfd50523e4bdbba587496272b6dad8c51d25ff/src/libs/ReportUtils.ts#L4051-L4053

This results in sending the payerOwesAmount: https://github.com/Expensify/App/blob/2dcfd50523e4bdbba587496272b6dad8c51d25ff/src/libs/ReportUtils.ts#L3086-L3088

Which is why even when we update the report name it doesn't reflect

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

We should always return report?.reportName whenever we have invoice reports present.

    if (isInvoiceReport(report)) {
        formattedName = report?.reportName;
    }

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

We should write a unit test to render the header and report details page for a invoice report. And render the text to be matched with the reportName of the invoice.

What alternative solutions did you explore? (Optional)

twilight2294 avatar Dec 06 '24 11:12 twilight2294

Proposal

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

Invoice title doesn't change when renamed.

What is the root cause of that problem?

I believe the real issue here is that we let the user rename the report title field. The title field menu will show if there exists a report field with the type of title. https://github.com/Expensify/App/blob/36b9b442a07865684ce8740fd9b1325dd1933bd3/src/pages/ReportDetailsPage.tsx#L752-L755

The invoice report itself doesn't have any report field, but the policy linked to the invoice has. If we see the logic in MoneyReportView, we will only render the report field if it's an expense report in a paid policy. https://github.com/Expensify/App/blob/36b9b442a07865684ce8740fd9b1325dd1933bd3/src/components/ReportActionItem/MoneyReportView.tsx#L107-L116

The getMoneyRequestReportName function also checks for the same condition, an expense report in a paid policy. https://github.com/Expensify/App/blob/36b9b442a07865684ce8740fd9b1325dd1933bd3/src/libs/ReportUtils.ts#L3047-L3049

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

So, I think the solution here is to not show the report field if it's not an expense report in a paid policy. We can do that by early return here. https://github.com/Expensify/App/blob/36b9b442a07865684ce8740fd9b1325dd1933bd3/src/pages/ReportDetailsPage.tsx#L752-L755

const titleField = useMemo<OnyxTypes.PolicyReportField | undefined>((): OnyxTypes.PolicyReportField | undefined => {
    if (!ReportUtils.isPaidGroupPolicyExpenseReport(report)) {
        return;
    }
    const fields = ReportUtils.getAvailableReportFields(report, Object.values(policy?.fieldList ?? {}));
    return fields.find((reportField) => ReportUtils.isReportFieldOfTypeTitle(reportField));
}, [report, policy?.fieldList]);

And since the report field title is now undefined, nameSectionExpenseIOU will be rendered, https://github.com/Expensify/App/blob/36b9b442a07865684ce8740fd9b1325dd1933bd3/src/pages/ReportDetailsPage.tsx#L878

which shows the report name for report with shouldDisableRename is true (which is true for invoice)

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

I think we can merge the invoice report to Onyx and render the ReportDetailsPage. Then, verify that the nameSectionExpenseIOU exists. We need to add a testID here so we can get the component by id. https://github.com/Expensify/App/blob/36b9b442a07865684ce8740fd9b1325dd1933bd3/src/pages/ReportDetailsPage.tsx#L687

bernhardoj avatar Dec 06 '24 11:12 bernhardoj

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

melvin-bot[bot] avatar Dec 06 '24 12:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 06 '24 12:12 melvin-bot[bot]

I remember reviewing a similar issue in the past with editing the report title field, and we ended up deciding to disable editing (I can't find the issue at the moment :/).

@twisterdotcom Can you confirm the expected behavior here? Should we allow user to edit the title field of an Invoice request?

hungvu193 avatar Dec 06 '24 16:12 hungvu193

@twisterdotcom, @hungvu193 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 10 '24 09:12 melvin-bot[bot]

little bump @twisterdotcom

hungvu193 avatar Dec 11 '24 07:12 hungvu193

Do you know where that other issue is? I can sort of see the logic in not allowing edits to avoid somebody changing it from say "Services - July 2024" to "Services - December 2024", because you'd expect a new invoice. But we would want them to be able to edit it from "Services Jluy 2023" to "Services - July 2024" - basically fix mistakes, not block improper actions.

On balance, I think allowing the former will resolve more confusion and customer cases than blocking the latter, so let's go ahead with allowing edits.

twisterdotcom avatar Dec 11 '24 13:12 twisterdotcom

hey, there is a issue to fix the invoice title https://github.com/Expensify/App/issues/53914, I think we should close that issue and merge it into this one

twilight2294 avatar Dec 11 '24 13:12 twilight2294

Asked @rezkiy37 in there.

twisterdotcom avatar Dec 11 '24 17:12 twisterdotcom

Hi, I am Michael (Mykhailo) from Callstack, an expert agency and I can work on this issue.

rezkiy37 avatar Dec 11 '24 19:12 rezkiy37

Preparing a PR - https://github.com/Expensify/App/pull/54031.

rezkiy37 avatar Dec 12 '24 12:12 rezkiy37

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

melvin-bot[bot] avatar Dec 23 '24 21:12 melvin-bot[bot]

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

  • https://github.com/Expensify/App/pull/54031

If no regressions arise, payment will be issued on 2024-12-30. :confetti_ball:

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

  • @hungvu193 requires payment through NewDot Manual Requests
  • @rezkiy37 does not require payment (Contractor)

melvin-bot[bot] avatar Dec 23 '24 21:12 melvin-bot[bot]

@hungvu193 @twisterdotcom @hungvu193 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]

melvin-bot[bot] avatar Dec 23 '24 21:12 melvin-bot[bot]

Payment Summary

Upwork Job

  • Reviewer: @hungvu193 owed $250 via NewDot
  • Contributor: @rezkiy37 is from an agency-contributor and not due payment

BugZero Checklist (@twisterdotcom)

  • [x] I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • [x] I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1865017078260739311/hired)
  • [x] I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • [x] I have verified the payment summary above is correct

melvin-bot[bot] avatar Dec 30 '24 09:12 melvin-bot[bot]

BugZero Checklist:

  • [x] [Contributor] Classify the bug:
Bug classification

Source of bug:

  • [ ] 1a. Result of the original design (eg. a case wasn't considered)
  • [x] 1b. Mistake during implementation
  • [ ] 1c. Backend bug
  • [ ] 1z. Other:

Where bug was reported:

  • [x] 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • [ ] 2b. Reported on staging (eg. found during regression or PR testing)
  • [ ] 2d. Reported on a PR
  • [ ] 2z. Other:

Who reported the bug:

  • [ ] 3a. Expensify user
  • [x] 3b. Expensify employee
  • [ ] 3c. Contributor
  • [ ] 3d. QA
  • [ ] 3z. Other:
  • [x] [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: N/A

  • [x] [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: N/A

  • [x] [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.

Test:

Precondition: Invoices feature must be enabled.

Invoices are enabled.

  1. Login with any account.
  2. Go to FAB > Send invoice.
  3. Send an invoice to anyone.
  4. In the invoice room, click on the invoice preview.
  5. Click on the report title.
  6. Click on the invoice title.
  7. Rename and save it.
  8. Verify that you can change the invoice title.

Do we agree 👍 or 👎

hungvu193 avatar Jan 02 '25 01:01 hungvu193

@twisterdotcom, @hungvu193, @cristipaval, @rezkiy37 Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Jan 02 '25 09:01 melvin-bot[bot]

@twisterdotcom, @hungvu193, @cristipaval, @rezkiy37 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Jan 06 '25 09:01 melvin-bot[bot]

Payment Summary:

  • @hungvu193 paid $250 via NewDot Manual Request
  • @rezkiy37 does not require payment (Contractor)

twisterdotcom avatar Jan 06 '25 17:01 twisterdotcom

$250 approved for @hungvu193

garrettmknight avatar Jan 07 '25 18:01 garrettmknight