-
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
[CP Staging] Expense - No option to cancel payment for paid expense as 3-dot menu is removed #45130
[CP Staging] Expense - No option to cancel payment for paid expense as 3-dot menu is removed #45130
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-07-10.at.4.58.24.AM.movAndroid: mWeb ChromeScreen.Recording.2024-07-10.at.4.57.54.AM.moviOS: NativeScreen.Recording.2024-07-10.at.4.57.15.AM.moviOS: mWeb SafariScreen.Recording.2024-07-10.at.4.56.43.AM.movMacOS: Chrome / SafariScreen.Recording.2024-07-10.at.4.53.54.AM.movMacOS: DesktopScreen.Recording.2024-07-10.at.4.55.56.AM.mov |
const isPayer = ReportUtils.isPayer(session, moneyRequestReport); | ||
const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID ?? '-1'); | ||
|
||
const shouldShowCancelPaymentButton = caseID === CASES.MONEY_REPORT && isPayer && isSettled && ReportUtils.isExpenseReport(moneyRequestReport); |
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.
Should we make a utility function out of this?
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.
Also, why are we adding this extra check here? This did not exist in the MoneyReportHeader
component previously.
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 don't think that is necessary, this is done in the same way as shouldShowLeaveButton
and canUnapproveRequest
have been handled in the same file.
This is also the only place where the payment cancellation use-case gets called.
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.
Again, the extra check is due to ReportDetailsPage
unifying the functionality of three different components from before, MoneyRequestHeader
, MoneyReportHeader
and HeaderView
. I wanted to make sure this only works for the case which it comes from, hence the CASES.MONEY_REPORT
check.
src/pages/ReportDetailsPage.tsx
Outdated
if (!moneyRequestReport) { | ||
return; | ||
} |
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.
Why are we adding this extra condition? I don't see it being used in MoneyReportHeader
component.
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 sort of check has to be added here, since for ReportDetailsPage
, which combines MoneyReportHeader
, MoneyRequestHeader
and HeaderView
logic after Details Revamp, moneyRequestReport
might be undefined in other cases, unlike in MoneyReportHeader
, which had it as a required argument passed to the component.
I have moved this logic into the IOU.cancelPayment();
function and changed it to support OnyxEntry<OnyxTypes.Report>
. This unifies the cancel function with other IOU functions such as IOU.unapproveExpenseReport();
and should be a good solution here.
@allroundexperts ready for another look |
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.
Thanks for the explanation. This works well!
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.
Thanks for a quick work, just one question, I will move it ahead still though. I believe Alberto is now out
@@ -263,6 +264,21 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD | |||
const shouldShowWriteCapability = !isMoneyRequestReport; | |||
const shouldShowMenuItem = shouldShowNotificationPref || shouldShowWriteCapability || (!!report?.visibility && report.chatType !== CONST.REPORT.CHAT_TYPE.INVOICE); | |||
|
|||
const isPayer = ReportUtils.isPayer(session, moneyRequestReport); | |||
const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID ?? '-1'); |
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 wonder if we need this default really
const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID ?? '-1'); | |
const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID); |
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 might be obsolete but I wanted to add it as an extra percussion to make sure this doesn't cause a crash anytime in the app.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…yment-fix [CP Staging] Expense - No option to cancel payment for paid expense as 3-dot menu is removed (cherry picked from commit c973e62)
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.0.5-13 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
QA worked well Screen.Recording.2024-07-10.at.11.21.37.mov |
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.5-13 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.6-0 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.6-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.6-8 🚀
|
Details
Add
Cancel payment
button from the 3-dot menu that has been removed back intoReportDetailsPage
.Fixed Issues
$ #45077
PROPOSAL:
Tests
Cancel payment
appears in the details page and works properly.Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop
Screen.Recording.2024-07-10.at.01.11.18.mov