-
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
Feat: Update how GBR is determined for IOU/expense reports #30655
Conversation
Reviewer Checklist
Screenshots/Videos |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will a report
ever have this property?
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.
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.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this one could also be an "option"
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like for the most part all the things we need are there 🤷
@@ -116,8 +116,7 @@ function OptionRowLHN(props) { | |||
|
|||
const hasBrickError = optionItem.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath did you think about the case of archived options too? see #30824 (comment)
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.
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 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
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)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.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