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

Fix wrong total amount of hold expenses when approve/pay partially #49971

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

bernhardoj
Copy link
Contributor

@bernhardoj bernhardoj commented Oct 1, 2024

Details

When approving/paying the report partially, the total held amount is wrong.

Fixed Issues

$ #48760
PROPOSAL: #48760 (comment)

Tests

Same as QA Steps

  • Verify that no errors appear in the JS console

Offline tests

Same as QA Steps

QA Steps

  1. Open a workspace chat
  2. Submit 3 expenses (1 expense with a different currency) and track 1 expense
  3. Hold 2 of the submitted expenses (1 with a different currency)
  4. Go back to the main chat
  5. Approve the report partially
  6. Verify the main chat LHN owes amount is correct (shows the total amount of the hold expenses)
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4

@bernhardoj bernhardoj requested a review from a team as a code owner October 1, 2024 08:38
@melvin-bot melvin-bot bot requested review from s77rt and removed request for a team October 1, 2024 08:38
Copy link

melvin-bot bot commented Oct 1, 2024

@s77rt Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@@ -6448,7 +6448,7 @@ function getReportFromHoldRequestsOnyxData(
chatReport.reportID,
chatReport.policyID ?? iouReport?.policyID ?? '',
recipient.accountID ?? 1,
holdTransactions.reduce((acc, transaction) => acc + transaction.amount, 0) * (ReportUtils.isIOUReport(iouReport) ? 1 : -1),
((iouReport?.total ?? 0) - ((iouReport?.unheldTotal ?? 0) + (iouReport?.nonReimbursableTotal ?? 0))) * (ReportUtils.isIOUReport(iouReport) ? 1 : -1),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the unheldTotal doesn't include the nonReimbursableTotal, I add them together. If I have 3 expenses,

A: $1 (track, non-reimbursable)
B: $2 (held)
C: $3

The total is $6, unheldTotal is $3, and nonReimbursableTotal is $1.

held total = $6 - ($3 + $1) = $2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm pretty confident that we can/should add them together because of this logic.

App/src/libs/actions/IOU.ts

Lines 6667 to 6670 in 76c5c81

let total = (iouReport?.total ?? 0) - (iouReport?.nonReimbursableTotal ?? 0);
if (ReportUtils.hasHeldExpenses(iouReport?.reportID ?? '') && !full && !!iouReport?.unheldTotal) {
total = iouReport?.unheldTotal;
}

The logic above calculates the pay amount to show.

It subtracts the total from the nonReimbursableTotal. But if there are held expenses and it's paid partially, then we just use the unheldTotal which means the unheldTotal doesn't contain the nonReimbursableTotal.

unheldTotal = the total reimbursable amount that is not held

@@ -6448,7 +6448,7 @@ function getReportFromHoldRequestsOnyxData(
chatReport.reportID,
chatReport.policyID ?? iouReport?.policyID ?? '',
recipient.accountID ?? 1,
holdTransactions.reduce((acc, transaction) => acc + transaction.amount, 0) * (ReportUtils.isIOUReport(iouReport) ? 1 : -1),
((iouReport?.total ?? 0) - ((iouReport?.unheldTotal ?? 0) + (iouReport?.nonReimbursableTotal ?? 0))) * (ReportUtils.isIOUReport(iouReport) ? 1 : -1),
getCurrency(firstHoldTransaction),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you fix the currency to use the iou's currency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, forgot about it. Fixed.

Copy link
Contributor

@s77rt s77rt left a comment

Choose a reason for hiding this comment

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

Approving non-reimbursable transactions shows incorrect amount, in the below screenshot it should state "Approve only DZD 5.00"

Screenshot 2024-10-01 at 4 49 25 PM

@bernhardoj
Copy link
Contributor Author

Yep, I noticed that too, but that's how it's in prod too. I was thinking of adding the unheldTotal with the nonReimbursableTotal too.

Before: Approve only $unheldTotal
After: Approve only $unheldTotal+nonReimbursableTotal

Do you agree with that? Or should we have someone from the team to confirm the behavior first?

@s77rt
Copy link
Contributor

s77rt commented Oct 2, 2024

I think the calculated unheldTotal is wrong. It should already include the non-reimbursable amounts. Can we fix this here?

@bernhardoj
Copy link
Contributor Author

bernhardoj commented Oct 2, 2024

unheldTotal isn't calculated on the FE.

@s77rt
Copy link
Contributor

s77rt commented Oct 2, 2024

Ah, I think this needs to be fixed in BE then. cc @robertjchen

Bug: report.unheldTotal does not include non-reimbursable transactions

Steps to reproduce:

  1. Have an IOU report with multiple expenses including non-reimbursable transactions
  2. Hold all reimbursable transactions
  3. Press Approve

Expected: the green button to state "Approve only DZD X.XX"
Results: the green button states "Approve only DZD 0.00" (see #49971 (review))

Suggested solutions:

  1. Have unheldTotal include non-reimbursable transactions
  2. Add another prop e.g. unheldNonReimbursableTotal

@s77rt
Copy link
Contributor

s77rt commented Oct 2, 2024

@bernhardoj

After: Approve only $unheldTotal+nonReimbursableTotal

That won't work because we are not taking into account held non-reimbursable transactions

@bernhardoj
Copy link
Contributor Author

Non reimbursable transaction can't be hold.

@trjExpensify
Copy link
Contributor

Non reimbursable transaction can't be hold.

Hm, is that true @JmillsExpensify @robertjchen?

@JmillsExpensify
Copy link

That should not be true, no. You should be able to hold any transaction.

@bernhardoj
Copy link
Contributor Author

bernhardoj commented Oct 5, 2024

Oh, then it's a bug then. There is no option to Hold non-reimbursable in ND.

@robertjchen
Copy link
Contributor

So, to clarify- given this, the backend needs to be updated such so that: unheldTotal include[s] non-reimbursable transactions?

@bernhardoj
Copy link
Contributor Author

I'm honestly not sure if we should include non-reimbursable to unheldTotal. If we have 1 hold transaction and 1 non-reimbursable transaction,

Currently, the confirmation modal will say either Pay 0 (unheldTotal) or Pay fullAmount.
image

If we include non-reimbursable transaction to unheldTotal, the confirmation modal will either say Pay nonReimbursableAmount (unheldTotal) or Pay fullAmount.

Add another prop e.g. unheldNonReimbursableTotal

I think it's best to include non-reimbursable transaction to unheldTotal and add a new unheldNonReimbursableTotal property, then we can calculate the unheldReimbursableTotal and show it on the confirm modal.

Before:
total: held and unheld total amount of reimbursable and non-reimbursable
unheldTotal: unheld total amount of reimbursable
nonReimbursableTotal: held and unheld total of non-reimbursable

After:
total: held and unheld total amount of reimbursable and non-reimbursable
unheldTotal: unheld total amount of reimbursable and non-reimbursable
nonReimbursableTotal: held and unheld total of non-reimbursable
unheldNonReimbursableTotal: unheld total of non-reimbursable

Calculating unheldReimbursableTotal will be = unheldTotal - unheldNonReimbursableTotal
"Pay unheldReimbursableTotal or Pay fullAmount"
"Approve unheldReimbursableTotal or Pay fullAmount"

Oh, then it's a bug then. There is no option to Hold non-reimbursable in ND.

But first, I think we should fix this first?

@trjExpensify
Copy link
Contributor

How do we expect this to work, @JmillsExpensify? Is it:

  • Only display the reimbursable report total in the modal for that second “pay everything and take what’s on hold off hold” choice?
  • When deciding to pay all reimbursable expenses, what happens to the held non-reimbursable expenses on the report? Do those come off hold as well, or do they stay on hold and get moved?

@s77rt
Copy link
Contributor

s77rt commented Oct 7, 2024

@bernhardoj

If we include non-reimbursable transaction to unheldTotal, the confirmation modal will either say Pay nonReimbursableAmount (unheldTotal) or Pay fullAmount.

That's the expected.

I think it's best to include non-reimbursable transaction to unheldTotal and add a new unheldNonReimbursableTotal property, then we can calculate the unheldReimbursableTotal and show it on the confirm modal.

In the approve modal we should show the unheldTotal which should include both reimbursable and non-reimbursable transactions.

@JmillsExpensify
Copy link

That's all fair feedback above, and on second thought, we struggled with this consideration in the design doc – enough that we put this in the out-of-scope section of the doc. In fact, there are kind of two cases to consider here:

unheldTotal: unheld total amount of reimbursable and non-reimbursable

This only matters for approval, as you can legitimately approve both reimbursable and non-reimbursable expenses. It is impossible to pay a non-reimbursable in 100% of cases.

As a result, I think if we went this route, then we would only show the unheldTotal as a sum of reimbursable and non-reimbursable for the approve case. We can never ask if you'd like to pay the unheldTotal for non-reimbursable expenses, because you can't pay them.

@s77rt
Copy link
Contributor

s77rt commented Oct 7, 2024

Ah right, then can we go with the following:

BE:

  1. Make unheldTotal include both reimbursable and non-reimbursable transactions
  2. Add unheldNonReimbursableTotal

FE:

In the approve modal display:

  • Partial: unheldTotal
  • Full: total

In the pay modal display:

  • Partial: unheldTotal - unheldNonReimbursableTotal
  • Full: total - nonReimbursableTotal

Does that make sense?

@trjExpensify
Copy link
Contributor

Ah right, then can we go with the following:

BE:

  1. Make unheldTotal include both reimbursable and non-reimbursable transactions
  2. Add unheldReimbursableTotal

FE:

In the approve modal display:

  • Partial: unheldTotal
  • Full: total

In the pay modal display:

  • Partial: unheldTotal - unheldNonReimbursableTotal
  • Full: total - nonReimbursableTotal

Does that make sense?

If we're adding unheldReimbursableTotal, why not use that in the Pay modal? instead of unheldTotal - unheldNonReimbursableTotal?

I think this question is still outstanding:

When deciding to pay all reimbursable expenses, what happens to the held non-reimbursable expenses on the report? Do those come off hold as well, or do they stay on hold and get moved?

@s77rt
Copy link
Contributor

s77rt commented Oct 8, 2024

@trjExpensify

If we're adding unheldReimbursableTotal

Sorry, we won't, I meant to write unheldNonReimbursableTotal. Corrected

When deciding to pay all reimbursable expenses, what happens to the held non-reimbursable expenses on the report? Do those come off hold as well, or do they stay on hold and get moved?

They come off hold same as held reimbursable transactions.

@trjExpensify
Copy link
Contributor

Sorry, we won't, I meant to write unheldNonReimbursableTotal. Corrected

Gotcha. 👍

When deciding to pay all reimbursable expenses, what happens to the held non-reimbursable expenses on the report? Do those come off hold as well, or do they stay on hold and get moved?
They come off hold same as held reimbursable transactions.

I think the UX might be a bit strange on that one as it's not communicated in the modal, but let's see I guess.

@s77rt
Copy link
Contributor

s77rt commented Oct 11, 2024

@robertjchen Are we aligned with the changes here #49971 (comment) if so, can you please work on the BE changes? Those are breaking-changes (due to unheldTotal change), do we have a pattern to follow in such cases?

@robertjchen
Copy link
Contributor

robertjchen commented Oct 22, 2024

Ah that is true- from that perspective, the total should technically be the same. In any case, the unheldNonReimbursableTotal and nonReimbursableTotal fix has now been deployed. Let me know if you see the proper signage on those amounts, thanks! 🙇

Comment on lines +2084 to +2086
if (typeof iouReport.unheldTotal === 'number') {
iouReport.unheldTotal -= amount;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a case where unheldTotal wouldn't exist? If we have an expense report where all the transactions are reminbursable will we have:

  1. unheldTotal set to total
  2. unheldTotal not set at all (undefined)

cc @robertjchen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In main, we don't add unheldTotal and unheldNonReimbursableTotal when creating the report optimistically (buildOptimisticExpenseReport only, IOU not yet, waiting for the IOU total bug to be fixed), so it will be undefined. But in this PR, I already added both optimistically, so it will never be undefined anymore optimistically. I don't know about the BE.

Copy link
Contributor

Choose a reason for hiding this comment

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

For BE, we will always return these fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the confirmation. That means we could technically update the typing for the total, unheldTotal, nonReimbursableTotal, and unheldNonReimbursableTotal to be non-undefined/null, but if we want to do that, we need to update all report optimistic creation (buildOptimisticChatReport, buildOptimisticTaskReport, etc.) to include them all, which isn't the case for now.

src/libs/actions/IOU.ts Outdated Show resolved Hide resolved
src/libs/actions/IOU.ts Outdated Show resolved Hide resolved
src/libs/actions/IOU.ts Outdated Show resolved Hide resolved
src/libs/actions/IOU.ts Outdated Show resolved Hide resolved
src/types/onyx/Report.ts Outdated Show resolved Hide resolved
@bernhardoj
Copy link
Contributor Author

In any case, the unheldNonReimbursableTotal and nonReimbursableTotal fix has now been deployed. Let me know if you see the proper signage on those amounts, thanks!

@robertjchen thanks, it's now negative.

Ah that is true- from that perspective, the total should technically be the same.

Now waiting for this one 😄

@robertjchen
Copy link
Contributor

@bernhardoj Given how the backend is designed, I cannot change the total. I can however, provide the desired amount via a new variable- this would be the unheld and held amounts (both reimbursable and non-reimbursable) is that correct?

src/libs/actions/IOU.ts Outdated Show resolved Hide resolved
@bernhardoj
Copy link
Contributor Author

bernhardoj commented Oct 24, 2024

Good news, I just retested and the IOU total issue doesn't happen anymore (hopefully it stays like this).

} else {
iouReportUpdate.total += isDeleting ? amount : -amount;
if (!isOnhold) {
iouReportUpdate.unheldTotal += isDeleting ? amount : -amount;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the optimistic unheldTotal for IOU too. However, there is a problem.

  1. User A submit $2 and $2 to user B (total = 4, unheldTotal = 4, owner = user A)
  2. User A hold $2 (total = 4, unheldTotal = 2, owner user A)
  3. User B submit $10

When user B submits, it will go into the else block, subtracting total from the amount (10). So, the new total will be -6. If it's < 0, we switch the owner with this logic and switch the sign too, so the new optimistic total is 6.

App/src/libs/IOUUtils.ts

Lines 96 to 100 in 866ce4b

if (iouReportUpdate.total < 0) {
// The total sign has changed and hence we need to flip the manager and owner of the report.
iouReportUpdate.ownerAccountID = iouReport.managerID;
iouReportUpdate.managerID = iouReport.ownerAccountID;
iouReportUpdate.total = -iouReportUpdate.total;

The problem I see is, that BE still keeps the sign, so the total from BE is -6. Also, the unheldTotal is -8, which looks like it comes from unheldTotal (2) - amount (10). So, I apply this calculation for the optimistic one too as you can see above. I'm not sure if the unheldTotal should be -8, but at least I match it with the BE. I think it will be another big problem to solve and decide the expected behavior.

Notice the image below shows Pay -8 (unheldTotal).

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this looks tricky, i think we need to agree on the expected behaviour on what the total and the unheldTotal should be in this case and also in the case where we unhold the $2 request. (can we still unhold that request? and how can do it?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can still unhold it and the unheldTotal will be the same as total (-6). If I hold it again, it will be -8 again.

User A submit $2 and $2 to user B (total = 4, unheldTotal = 4, owner = user A)
User A hold $2 (total = 4, unheldTotal = 2, owner user A)
User B submit $10

I think if we have this case, the new total should be 6 (number is correct already in prod, but it's in negative) and unheldTotal should be:

current held = total (4) - unheldTotal (2) = 2
new unheldTotal = new total (6) - current held (2) = 4

I suspect the BE already did this calculation, but because the total is negative (-6), subtracting with 2 will be -8.

cc: @robertjchen

Copy link
Contributor

Choose a reason for hiding this comment

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

unheldTotal on the backend is simply the reimbursable total (excluding held transactions) + non reimbursable total (excluding held transactions).

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the problem around IOUs and expense reports having different signage? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

@robertjchen According to this comment

App/src/libs/IOUUtils.ts

Lines 63 to 71 in 95aab1f

/**
* The owner of the IOU report is the account who is owed money and the manager is the one who owes money!
* In case the owner/manager swap, we need to update the owner of the IOU report and the report total, since it is always positive.
* For example: if user1 owes user2 $10, then we have: {ownerAccountID: user2, managerID: user1, total: $10 (a positive amount, owed to user2)}
* If user1 requests $17 from user2, then we have: {ownerAccountID: user1, managerID: user2, total: $7 (still a positive amount, but now owed to user1)}
*
* @param isDeleting - whether the user is deleting the expense
* @param isUpdating - whether the user is updating the expense
*/
the bug is from the backend because the returned total (and unheldTotal) are negative but are expected to stay positive

Copy link
Contributor

Choose a reason for hiding this comment

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

@Gonals May be able to help if that logic is no longer true?

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, we haven't changed that, but it has been a loooong while since I touched that area

Copy link
Contributor

Choose a reason for hiding this comment

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

@robertjchen Would you be able to check again so we can move forward here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robertjchen Just merged with the main and fixed some conflicts. I think we just need a confirmation whether it's necessarry need to do this or not.

image

}

if (iouReportUpdate.total < 0) {
// The total sign has changed and hence we need to flip the manager and owner of the report.
iouReportUpdate.ownerAccountID = iouReport.managerID;
iouReportUpdate.managerID = iouReport.ownerAccountID;
iouReportUpdate.total = -iouReportUpdate.total;
iouReportUpdate.unheldTotal = -iouReportUpdate.unheldTotal;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though the BE stores it as negative, I still switch the sign here optimistically just to make it consistent with total and I think it should be the correct amount, in positive.

@s77rt
Copy link
Contributor

s77rt commented Nov 22, 2024

@bernhardoj Can you please merge main, let's get this to the finish line

@bernhardoj
Copy link
Contributor Author

Done

@s77rt
Copy link
Contributor

s77rt commented Nov 22, 2024

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
android.mov
Android: mWeb Chrome
mweb-chrome.mov
iOS: Native
ios.mov
iOS: mWeb Safari
mweb-safari.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov

@s77rt
Copy link
Contributor

s77rt commented Nov 22, 2024

Can you check the failing lint and ts

@bernhardoj
Copy link
Contributor Author

Fixed

Copy link
Contributor

@s77rt s77rt left a comment

Choose a reason for hiding this comment

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

LGTM but we have this bug that we should handle separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants