Feat: Update how GBR is determined for IOU/expense reports#30655
Feat: Update how GBR is determined for IOU/expense reports#30655puneetlath merged 27 commits intomainfrom
Conversation
Reviewer Checklist
Screenshots/Videos |
Co-authored-by: Marc Glasser <marc@expensify.com>
src/libs/ReportUtils.js
Outdated
|
|
||
| // Current user is an admin and the report has been approved but not settled yet | ||
| return policy.role === CONST.POLICY.ROLE.ADMIN && isReportApproved(report); | ||
| if (option.isUnreadWithMention) { |
There was a problem hiding this comment.
Will a report ever have this property?
There was a problem hiding this comment.
Crap, no it will not. Updated to check. Alternate would be to add the lastReadTime and lastMentionedTime to the optionItem. But I don't really love that either.
marcaaron
left a comment
There was a problem hiding this comment.
Few other small comments - idk if they need to be blockers.
| * @param {Object} [parentReportAction] - The parent report action of the report (Used to check if the task has been canceled) | ||
| * @returns {Boolean} | ||
| */ | ||
| function isWaitingForAssigneeToCompleteTask(report, parentReportAction = {}) { |
There was a problem hiding this comment.
Looks like this one could also be an "option"
There was a problem hiding this comment.
Idk though maybe we can do a follow up to address as long as all of these other methods are referencing fields that will exist on either a report or an option.
There was a problem hiding this comment.
Seems like for the most part all the things we need are there 🤷
| const defaultSubscriptSize = optionItem.isExpenseRequest ? CONST.AVATAR_SIZE.SMALL_NORMAL : CONST.AVATAR_SIZE.DEFAULT; | ||
| const shouldShowGreenDotIndicator = | ||
| !hasBrickError && (optionItem.isUnreadWithMention || optionItem.isWaitingForTaskCompleteFromAssignee || ReportUtils.isWaitingForIOUActionFromCurrentUser(optionItem)); | ||
| const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction); |
There was a problem hiding this comment.
I see we are using either the report (in this case, "option") or the parentReportAction to determine if the task is canceled. Why do we only pass the parentReportAction here?
|
|
||
| // Current user is an admin and the report has been approved but not settled yet | ||
| return policy.role === CONST.POLICY.ROLE.ADMIN && isReportApproved(report); | ||
| if (option.isUnreadWithMention || isUnreadWithMention(option)) { |
There was a problem hiding this comment.
Seems fine. Though - someone could possibly do something silly like add just one of the option.lastReadTime or option.lastMentionedTime. Can protect against this by only calling isUnreadWithMention() with option when option.isUnreadWithMention is undefined.
Not gonna block on that, but I think this review has kind of highlighted that the code needs reworking or something.
There was a problem hiding this comment.
I created this follow up to try and find a way to make this better: #30668
|
Thanks for the thorough review @marcaaron! I'm going to go ahead and merge this, but I created this follow up to try and clean up some of this logic to make it easier to follow/less likely to cause future bugs. #30668 |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.95-0 🚀
|
| if (isReportManager(report) && !isReportApproved(report)) { | ||
| return true; | ||
| } | ||
| if (isArchivedRoom(getReport(option.parentReportID))) { |
There was a problem hiding this comment.
@puneetlath did you think about the case of archived options too? see #30824 (comment)
There was a problem hiding this comment.
Ah yeah, I'm not sure why we did it this way. Thanks for handling!
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.95-9 🚀
|
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.96-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.96-15 🚀
|






Details
This is a copy of #29778 with a couple commits added. It updates how the GBR is determined in the LHN on the client.
Fixed Issues
$ #29595
Tests
Offline tests
Same as tests
QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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.Behaviour is the same for all platforms, attaching screenshots for focused and most recent for IOU green dot
Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop