-
Notifications
You must be signed in to change notification settings - Fork 3k
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 new individual invoice after one is paid as a business #54138
Conversation
Hi, this is ready for review now. The lint check is failing due to new rules about defaulting IDs, but I didn't add any of that. It already exists on main in some of the files I touched. I tried fixing it, but it creates a cascading effect of more and more files to fix and I don't want to get stuck in that rabbit hole. Let's please get this issue fixed, then fix the lint check separately since that will be a huge PR. |
@allgandalf 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] |
Can you fix the failing |
This has conflicts 😞 |
Please see this comment. I resolved the merge conflicts. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-25.at.8.45.12.PM.movAndroid: mWeb ChromeScreen.Recording.2024-12-25.at.8.48.45.PM.moviOS: NativeScreen.Recording.2024-12-25.at.7.58.17.PM.moviOS: mWeb SafariScreen.Recording.2024-12-25.at.7.59.50.PM.movMacOS: Chrome / SafariScreen.Recording.2024-12-25.at.7.51.40.PM.movMacOS: DesktopScreen.Recording.2024-12-25.at.7.55.27.PM.mov |
tests/data/Invoice.ts
Outdated
lastActorAccountID: 32, | ||
lastMessageHtml: 'paid $1.00', | ||
lastMessageText: 'paid $1.00', | ||
lastMessageTranslationKey: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastMessageTranslationKey: '', |
Details for this change shared 1:1 on slack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, only one comment I will complete the checklist either ways
Log.warn('getReceiverType called with no receiverParticipant'); | ||
return CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL; | ||
} | ||
if ('type' in receiverParticipant && receiverParticipant.type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess optional chaining was troubling here 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the type narrowing seems to be necessary because the receiverParticipant is a combination of two types.
@@ -63,6 +63,8 @@ type WhitelistedReport = OnyxCommon.OnyxValueWithOfflineFeedback< | |||
}; | |||
// eslint-disable-next-line @typescript-eslint/naming-convention | |||
private_isArchived: unknown; | |||
state: unknown; | |||
welcomeMessage: unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment is strange. The whole thing is pretty confusing. It's just listing all the fields in the report and asserting that they're in the report type. I don't find any value in that because it's totally circular.
I found the related issue, and the goal there is to move client only keys out of the report type. So now I understand the purpose. It also doesn't really make sense to limit that to the OpenApp call, I think OpenReport is also a valid way to tell which keys come from the server. I checked the response and I see that welcomeMessage is returned but state is not, so I'll remove state.
Thanks for pointing this out.
and we have conflicts... |
Don't think those conflicts are any major thing, so i will continue with uploading the videos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Tests well, lets fix the conflicts and we can merge 🚀
@puneetlath 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] |
Please ignore the failing es lint @puneetlath , have a look at this comment |
@puneetlath looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
Merged even though ESLint was failing based on this reasoning. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.0.80-1 🚀
|
@neil-marcellini This PR is failing with issue #54723 https://platform.utest.com/services/links/v1/internal/55801408?.mp4 |
Explanation of Change
The main change is
ReportUtils.getInvoiceChatByParticipants
, which now must have areceiverType
passed. That fixes the root cause of the linked issue, because now this function will only get a report with the proper receiver type. Previously, after one invoice was sent to and individual and then paid as a business, sending another invoice to the individual would incorrectly try to use the converted invoice chat, which caused a backend error. Now the function will not find an individual invoice chat, and correctly create a new one. I added a unit test in ReportUtilsTest using data from manual testing which is stored intests/data/Invoice.ts
. That data included some fields which were not part of the type definitions, so I added those and had to adjust types in a few other places.Fixed Issues
$ #53019
$ https://github.com/Expensify/Expensify/issues/401789
PROPOSAL: #53019 (comment)
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
I only tested on Mac Chrome because the changes are to one function that is platform independent.
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
2024-12-17_10-29-13.mp4
MacOS: Desktop