-
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
Add checks for editing APPROVED reports #33633
Conversation
@mananjadhav 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] |
@mananjadhav can you please give me three brand new emails so I can set you up in a Collect test policy, something like:
|
Friendly bump @mananjadhav, this issue is tied to our roadmap, if we can treat it with urgency it'd be great 🙏 |
Ohh I missed this. I can take a look today. |
@youssef-lr While I start with the review, can you fix the Typescript error? and work on the author checklist? |
@mananjadhav I'm on it, but you can test everything meanwhile, it shouldn't be a blocker |
bump on this please |
I started and I'll take 2-3 hours. |
I'm honestly not sure why TypeScript is showing that error, the same line is used here as well...do you have any clues? |
I am still away from keyboard and I am not sure if I can get to it for next few hours. I've asked to reassign if someone can get it earlier. |
I am also not sure, but I checked the other method. When I hover over |
src/libs/ReportUtils.ts
Outdated
return true; | ||
} | ||
|
||
const reportID = reportAction?.originalMessage?.IOUReportID ?? 0; |
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.
At the other two places, where we are using this reportAction?.originalMessage?.IOUReportID
reportAction is narrowed to CONST.REPORT.ACTIONS.TYPE.IOU
. If we narrow it down here as well typescript will stop complaining.
const reportID = reportAction?.originalMessage?.IOUReportID ?? 0; | |
const reportID = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? reportAction?.originalMessage?.IOUReportID : 0; |
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.
Great catch, thanks! I'm going to cast instead because we know for sure the type of the action here
Looks like a bug in my PR, will look into it. |
I'm not able to reproduce it @c3024, I think just navigate away and back from the report and they should get disabled, this is an issue with Pusher updates I think ![]() |
Yes, refreshing the page fixes it. |
hmm, I will look into. Wouldn't Pusher update the dependencies of useMemo? |
I think it should but I just checked with removing useMemo in all canEditX fields and it worked fine. |
f66717a
to
ef32e99
Compare
ef32e99
to
7de81d4
Compare
Co-authored-by: Vit Horacek <[email protected]>
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.
Thank you!
|
||
// A flag for verifying that the current report is a sub-report of a workspace chat | ||
const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(report)), [report]); | ||
// if the policy of the report is either Collect or Control, then this report must be tied to workspace chat | ||
const isPolicyExpenseChat = ReportUtils.isGroupPolicy(report); |
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.
@mountiny woops this doesn't take into account Free policies, I'll revert this back to testing the policy is not personal
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.
Can you also rename it to isPaidGroupPolicy?
And create a new one name isGroupPolicy checking for free too? it can be done in a follow up too
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.
yeah that sounds good
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.
done, though I just found out we have the same method in PolicyUtils
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 we're creating a lot of redundant helper methods we should probably some day clean things up :D
src/libs/ReportUtils.ts
Outdated
function isDraftExpenseReport(report: OnyxEntry<Report>): boolean { | ||
return isExpenseReport(report) && report?.stateNum === CONST.REPORT.STATE_NUM.OPEN && report?.statusNum === CONST.REPORT.STATUS.OPEN; | ||
function isDraftExpenseReport(report: OnyxEntry<Report> | EmptyObject): boolean { | ||
return report?.stateNum === CONST.REPORT.STATE_NUM.OPEN && report?.statusNum === CONST.REPORT.STATUS.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.
Can you please bring this back? I think that there is code which relies on the check for expense report, afaik for you changes it will work too, only expense reports can be in open state so we should keep it in
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.
woops sorry it was a mistake
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!
@youssef-lr looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
Tests passed |
✋ 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/youssef-lr in version: 1.4.23-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.23-4 🚀
|
Details
Fixed Issues
$ #29914
PROPOSAL:
Tests
IOUs (P2P requests)
Expense reports (request made in a workspace)
Expense reports - Collect policy
We will need three accounts here, an admin, the approver, and the submitter.
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 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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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