Repository navigation
Disabling report fields for non admin when report is approved. - #61726
Conversation
…t is approved and user is not the admin
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safariweb.mov |
| const isApproved = isReportApproved({report}); | ||
| if (!isAdmin && isApproved) { | ||
| return true; | ||
| } | ||
|
|
||
| return isTitleField ? !reportField?.deletable : !isAdmin && (isReportSettled || isReportClosed); |
There was a problem hiding this comment.
Can we rewrite this to include the title special case too? I'm not sure why we are solely relaying on reportField?.deletable. It may be helpful to check git blame to find what that condition is fixing
There was a problem hiding this comment.
We need this condition because of this #35043 (comment).
There was a problem hiding this comment.
@thienlnam (Assuming you are not an admin) If a report is approved, settled or closed. The title should not be modifiable regardless of its deletable field. Does that statement sound correct?
There was a problem hiding this comment.
@Tony-MK Can you please update the PR based on the above statement being true? Something like:
if (!isAdmin && (isReportSettled || isReportClosed || isApproved)) {
return true;
}
return isTitleField ? !reportField?.deletable : false;There was a problem hiding this comment.
Hey @s77rt, I was wondering if we should simplify it to:
return !isAdmin && (isReportSettled || isReportClosed || isApproved) || isTitleField && !reportField?.deletable;Or Switch:
return isTitleField ? !reportField?.deletable : false;For
return isTitleField && !reportField?.deletableThere was a problem hiding this comment.
Making this in one line is often hard to read, let's actually make another if condition
if (!isAdmin && (isReportSettled || isReportClosed || isApproved)) {
return true;
}
if (isTitleField) {
return !reportField?.deletable;
}
return false;There was a problem hiding this comment.
Yeah that sounds correct
|
@Tony-MK Can you please complete the checklist |
|
@Tony-MK, ETA on completing the checklist? |
|
Sorry for the delay. |
|
Apologies for the wait, @s77rt. I’ve completed the checklist, and I believe we're good to proceed. |
|
✋ 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/inimaga in version: 9.1.51-0 🚀
|
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.1.51-6 🚀
|





Explanation of Change
Adding a condition to disable the report fields for non admins if the report is approved.
Fixed Issues
$ #57416
PROPOSAL: #57416 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
macOS.-.Chrome.mov
MacOS: Desktop
macOS.-.Desktop.mov