-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Persist IOU data in Onyx #1785
Persist IOU data in Onyx #1785
Conversation
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.
Looks great, approving for now in case no additional changes are pushed 👍
Updated, #1785 (comment) is the only unresolved thread at the moment |
#1785 (comment) has been resolved, this is ready for review again! |
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.
Looking good, but a couple of issues mentioned above need addressing
I'm unable to reproduce this, what is the account setup you have for IOU testing?
I'm also unable to reproduce this, I see the IOU data get populated when logged in as both the IOU creator and the debtor. I will try testing with some additional cases (no report_actions from the debtor, create a report with IOUs from both parties) to try to reproduce. That testing brings up a good point however, since we're using the actorEmail to build the list of participants we may not be able to get the debtorEmail if the only person who has chatted on the report is the requestor. I'll have a look at that test case and if it is a problem, look into getting the debtorEmail another way. |
After some testing, I confirmed the issues above exist if the requestor is the only one with chats on a chat report. Therefore, using the actorEmail values in the reportHistory isn't enough to get the participants on a report.
The problem with this is that we don't have a managerEmail or ownerEmail in the response from getHistory. Additionally, fetching actions happens separately from where we fetch the rest of the report data, so we don't have access to the participants inside getActions where we're filtering by the "IOU" actionName. I looked into creating a local object that keeps track of the participants of each report, similar to how we keep track of lastReadSequenceNumbers or reportMaxSequenceNumbers. Then, in handleReportChanged, I tried setting the value of chatReportParticipants[report.reportID] = report.participants. However, there is still a race condition here since the actions can fetch before the participants are updated. Forcing the reportActions to wait until we are finished fetching the reportData is one way to fix this, but I'd rather not add that limitation unless we need to. Alternatively, we can make updates to the API to include participant data in one of the other API calls (GetHistory?). Bringing this to slack to chat about alternatives. |
I've created https://github.com/Expensify/Web-Expensify/pull/30506 and updated this PR so that In slack we agreed that the ideal solution would be to have Auth or the API handle figuring out the participants for a chat report, and to return all the necessary data, which will be handled in https://github.com/Expensify/Expensify/issues/157722. This is ready for review, but now requires https://github.com/Expensify/Web-Expensify/pull/30506 to work properly |
Thanks for all the comments and discussion! Updated this based on the discussion in slack. Since we're already fetching reportActions as part of I've also added some error handling for non-200 errors, empty reportList responses, and reportIDs of 0. I ran through the tests again and confirmed everything is working. This is ready for review again. |
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.
Agree with a a few previously mentioned comments.
Ran through the tests with no issues this time, Great work!
Updated and re-tested |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Sorry about not merging it! I was waiting for a test to finish... and apparently the GH page never updated when it was done. |
No worries! Those tests take a while! |
@Jag96 Hello! This one looks like it's internal QA. If so, can you go ahead with the testing? When done please let me know so I check the PR of the list. Thanks in advance! |
Checked this off 👍 |
This morning @trjExpensify and I noticed a potential regression with the Onyx changes: The While the simple solution would be to add a conditional check to confirm the iou object is valid, we need to confirm whether this requires a fix, or is now expected behavior. CC @kidroca IOURequestOnyxCrash.mov |
Details
This PR adds a new API command for
GetIOUReport
and starts persisting the IOUReport collection in Onyx.Fixed Issues
Fixes https://github.com/Expensify/Expensify/issues/157104
Tests
Application
tab and selectlocalhost:8080
underLocal Storage
reportIOU
CreateIOUTransaction
Curl request from https://github.com/Expensify/Expensify/issues/157104#issue-829068854 to create an IOU transaction. Ensure the debtorEmail is different from the email/accountID/authToken you set in the cookie fieldreportIOU_
that contains the IOU reportID. For an example of the full data, see https://github.com/Expensify/Expensify/issues/157104#issuecomment-799886417reportIOU_
that contains the IOU reportIDAdditionally, confirm that there are no regressions with sending messages to other accounts
Tested On
Screenshots
N/A