-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[HOLD] Feat: Update how GBR is determined for IOU/expense reports #29778
Changes from 11 commits
cb3f3d0
ddba0ec
4fca049
7523bd6
b8b6752
f6b79e6
f4cb009
63f6bd8
647efb8
de9e121
2bb9228
bfb06ae
a9c9ef2
0ce0891
dd4a7bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1314,12 +1314,15 @@ function getLastVisibleMessage(reportID, actionsToMerge = {}) { | |
} | ||
|
||
/** | ||
* Determines if a report has an IOU that is waiting for an action from the current user (either Pay or Add a credit bank account) | ||
* Determines if a report should show a GBR (green dot) in the LHN. This can happen when the report: | ||
- is unread and the user was mentioned in one of the unread comments | ||
- is for an outstanding task waiting on the user | ||
- has an outstanding child money request that is waiting for an action from the current user (e.g. pay, approve, add bank account) | ||
* | ||
* @param {Object} report (chatReport or iouReport) | ||
* @returns {boolean} | ||
*/ | ||
function isWaitingForIOUActionFromCurrentUser(report) { | ||
function shouldShowGBR(report) { | ||
if (!report) { | ||
return false; | ||
} | ||
|
@@ -1328,20 +1331,12 @@ function isWaitingForIOUActionFromCurrentUser(report) { | |
return false; | ||
} | ||
|
||
const policy = getPolicy(report.policyID); | ||
if (policy.type === CONST.POLICY.TYPE.CORPORATE) { | ||
// If the report is already settled, there's no action required from any user. | ||
if (isSettled(report.reportID)) { | ||
return false; | ||
} | ||
|
||
// Report is pending approval and the current user is the manager | ||
if (isReportManager(report) && !isReportApproved(report)) { | ||
return true; | ||
} | ||
if (report.isUnreadWithMention) { | ||
return true; | ||
} | ||
|
||
// 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 (report.isWaitingForTaskCompleteFromAssignee) { | ||
return true; | ||
} | ||
|
||
// Money request waiting for current user to add their credit bank account | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @waterim actually, we've decided to treat this condition like the others. If a report is waiting on bank account, we will add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @waterim I think we should remove this whole block:
|
||
|
@@ -1350,8 +1345,8 @@ function isWaitingForIOUActionFromCurrentUser(report) { | |
return true; | ||
} | ||
|
||
// Money request waiting for current user to Pay (from expense or iou report) | ||
if (report.hasOutstandingIOU && report.ownerAccountID && (report.ownerAccountID !== currentUserAccountID || currentUserAccountID === report.managerID)) { | ||
// Child report that is awaiting for current user to Pay | ||
waterim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (report.hasOutstandingChildRequest) { | ||
return true; | ||
} | ||
|
||
|
@@ -3287,7 +3282,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas, | |
} | ||
|
||
// Include reports that are relevant to the user in any view mode. Criteria include having a draft, having an outstanding IOU, or being assigned to an open task. | ||
if (report.hasDraft || isWaitingForIOUActionFromCurrentUser(report) || isWaitingForTaskCompleteFromAssignee(report)) { | ||
if (report.hasDraft || shouldShowGBR(report) || isWaitingForTaskCompleteFromAssignee(report)) { | ||
waterim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return true; | ||
} | ||
const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(report.reportID); | ||
|
@@ -4144,7 +4139,7 @@ export { | |
isCurrentUserTheOnlyParticipant, | ||
hasAutomatedExpensifyAccountIDs, | ||
hasExpensifyGuidesEmails, | ||
isWaitingForIOUActionFromCurrentUser, | ||
shouldShowGBR, | ||
isIOUOwnedByCurrentUser, | ||
getMoneyRequestReimbursableTotal, | ||
getMoneyRequestSpendBreakdown, | ||
|
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 see the task case covered in the function. Shouldn't it be?