-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
allow money requests on instantly submitted reports #36997
allow money requests on instantly submitted reports #36997
Conversation
@Ollyws |
Reviewer Checklist
Screenshots/VideosAndroid: Native01_Android_Native.mp4Android: mWeb Chrome02_Android_Chrome.mp4iOS: Native03_iOS_Native.mp4iOS: mWeb Safari04_iOS_Safari.mp4MacOS: Chrome / Safari05_MacOS_Chrome.mp4MacOS: Desktop06_MacOS_Desktop.mp4 |
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.
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.
It's looking like we're really close, but I have a few comments & one slightly larger concern, just to make sure we're not breaking anything - specifically related to optimistically creating a draft report which we should never do IFF the report is on an "Instant submit" policy
src/libs/actions/IOU.ts
Outdated
// If the linked expense report on paid policy is not draft and not instantly submitted, we need to create a new draft expense report | ||
if (iouReport && isFromPaidPolicy && !ReportUtils.isDraftExpenseReport(iouReport) && !ReportUtils.isInstantSubmittedState(iouReport)) { |
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.
Hmm this scares me a little bit... Like are we sure "we need to create a new draft expense report" in this case? I think no, because if we're requesting money on an expense report on an instant submit policy, we should be creating a submitted report (b/c "instant submit"), not a draft report 🤔
Do we have a manual test that covers this exact case? If so, are we sure this is working correctly?
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.
This is working correctly as Step 1
of our test case involves creating a new expense report.
But I think creating a new expense report is a little tricky too. In online scenarios, the BE would send back the submitted
state and it is all good in FE. But, in offline scenarios with instant
reporting frequency it does not seem right to create a new draft expense report. However, it also does not seem right to optimistically generate a submitted
report as the instant
reporting frequency may have been changed to something else in BE when the user is offline. So, ideally, it may be better to wait for the user to come online and let BE decide the right thing to do. Maybe the way to resolve this is to hide the Submit
button in the report preview and also in the expense report header in offline scenarios when it is instant
reporting frequency. Or maybe hide the submit
buttons at all times for instant
reporting frequency.
But this looks like a separate issue and may need some more thought through. Do you think creating a separate issue for this is better? We have already extended this issue’s scope with the handling of delete money request issues.
cc @Beamanator
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.
Maybe the way to resolve this is to hide the
Submit
button in the report preview and also in the expense report header in offline scenarios when it isinstant
reporting frequency. Or maybe hide thesubmit
buttons at all times forinstant
reporting frequency.
This should be the case - Are we currently able to see the Submit
button when the auto reporting frequency is instant
? If so, please let me know and I'll definitely make a new bug report for that :D 👍
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.
For the online / offline cases...
- If we know (before going offline) that the auto reporting frequency is
instant
, we DO need to optimistically auto-submit the report - we want to assume that the front & backends are sync'd, the "weird" scenario would be if they aren't. - Do you know exactly how this code in this line is hit? Is it really only when we're offline? I haven't taken the time to check but I'm happy to if you're not 100% certain 👍
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.
1 If we know (before going offline) that the auto reporting frequency is instant, we DO need to optimistically auto-submit the report - we want to assume that the front & backends are sync'd, the "weird" scenario would be if they aren't.
2. Do you know exactly how this code in this line is hit? Is it really only when we're offline? I haven't taken the time to check but I'm happy to if you're not 100% certain 👍
The code is hit in both offline and online scenarios. Offline, this will make the Submit
button appear and will go off only when the BE responds with a submitted
report. For online, the Submit
button is displayed for a short interval until the BE sends back the response. So, it makes sense to me too to optimistically auto-submit the report in this case.
To solve this, we can optimistically set the report to submitted
for instant
reporting frequency during the optimistic creation of an expense report here as shown below.
@Ollyws Does this change make sense?
const isOnInstantSubmitPolicy = policy && PolicyUtils.isInstantSubmitEnabled(policy as OnyxEntry<Policy>);
// Define the state and status of the report based on whether the policy is free or with `instant` reporting frequency
const stateNum = isOnInstantSubmitPolicy ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.OPEN;
const statusNum = isOnInstantSubmitPolicy ? CONST.REPORT.STATUS_NUM.SUBMITTED : CONST.REPORT.STATUS_NUM.OPEN;
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.
Agreed - and it looks like this is actually already being taken care of in https://github.com/Expensify/App/pull/36388/files#diff-577fcc5f3a5e4930916ff310e61c38edfa093792fe3ab55b9a30d2aecd8811db
Co-authored-by: Alex Beaman <dabeamanator@gmail.com>
Yes, we are able to see ProposalPlease re-state the problem that we are trying to solve in this issue.Name:
Actual Behaviour: Test Video - Actual Behavioursubmit-issue.mp4What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?The
Further, for
What alternative solutions did you explore? (Optional) |
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 I'm pretty happy with how this turned out, I want to just keep it unmerged for a few minutes to get some feedback in the slack thread
✋ 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/Beamanator in version: 1.4.45-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.45-6 🚀
|
@Ollyws @Beamanator
Details
This PR allows handling money requests for expense reports when
instant
submit auto-reporting frequency is set for the policy and when the expense report itself is in submitted state.Specifically, we allow:
Fixed Issues
$ #35814
PROPOSAL: #35814 (comment)
Test
Precondition:
scheduled submit
frequency toInstant
Steps:
manual
money request.Request money
option. —> Test 1Request money
and generate a newmanual
request.Context Menu
for the generated Money Request action displaysDelete request
option —> Test 3Delete request
option —> Test 4Offline tests
Same as the Steps in Tests Section.
QA Steps
Same as the Steps in Tests Section.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
MacOS: Safari
35814-web-safari.mp4
iOS: mWeb Safari
35814-mweb-safari.mp4
MacOS: Desktop
35814-desktop.mp4
iOS: Native
35814-native-ios.mp4
Android: Native
35814-native-android.mp4
Android: mWeb Chrome
35814-mweb-chrome.mp4