Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,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 ||
ReportUtils.isWaitingForIOUActionFromCurrentUser(optionItem) ||
(optionItem.isTaskReport && optionItem.isTaskAssignee && !optionItem.isCompletedTaskReport && !optionItem.isArchivedRoom));
!hasBrickError && (optionItem.isUnreadWithMention || optionItem.isWaitingForTaskCompleteFromAssignee || ReportUtils.isWaitingForIOUActionFromCurrentUser(optionItem));

/**
* Show the ReportActionContextMenu modal popover.
Expand Down
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHNData.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function OptionRowLHNData({

const optionItem = useMemo(() => {
// Note: ideally we'd have this as a dependent selector in onyx!
const item = SidebarUtils.getOptionData(fullReport, reportActions, personalDetails, preferredLocale, policy);
const item = SidebarUtils.getOptionData(fullReport, reportActions, personalDetails, preferredLocale, policy, parentReportAction);
if (deepEqual(item, optionItemRef.current)) {
return optionItemRef.current;
}
Expand Down
12 changes: 10 additions & 2 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,8 +1215,15 @@ function isWaitingForIOUActionFromCurrentUser(report) {
return false;
}

function isWaitingForTaskCompleteFromAssignee(report) {
return isTaskReport(report) && isReportManager(report) && isOpenTaskReport(report);
/**
* Checks if a report is an open task report assigned to current user.
*
* @param {Object} report
* @param {Object} parentReportAction - The parent report action of the report (Used to check if the task has been canceled)
* @returns {Boolean}
*/
function isWaitingForTaskCompleteFromAssignee(report, parentReportAction = {}) {
return isTaskReport(report) && isReportManager(report) && isOpenTaskReport(report, parentReportAction);
}

/**
Expand Down Expand Up @@ -3701,4 +3708,5 @@ export {
getReportPreviewDisplayTransactions,
getTransactionsWithReceipts,
hasMissingSmartscanFields,
isWaitingForTaskCompleteFromAssignee,
};
6 changes: 3 additions & 3 deletions src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ function getOrderedReportIDs(currentReportId, allReportsDict, betas, policies, p
* @param {Object} personalDetails
* @param {String} preferredLocale
* @param {Object} [policy]
* @param {Object} parentReportAction
* @returns {Object}
*/
function getOptionData(report, reportActions, personalDetails, preferredLocale, policy) {
function getOptionData(report, reportActions, personalDetails, preferredLocale, policy, parentReportAction) {
// When a user signs out, Onyx is cleared. Due to the lazy rendering with a virtual list, it's possible for
// this method to be called after the Onyx data has been cleared out. In that case, it's fine to do
// a null check here and return early.
Expand Down Expand Up @@ -266,8 +267,7 @@ function getOptionData(report, reportActions, personalDetails, preferredLocale,
result.isChatRoom = ReportUtils.isChatRoom(report);
result.isTaskReport = ReportUtils.isTaskReport(report);
if (result.isTaskReport) {
result.isCompletedTaskReport = ReportUtils.isCompletedTaskReport(report);
result.isTaskAssignee = ReportUtils.isReportManager(report);
result.isWaitingForTaskCompleteFromAssignee = ReportUtils.isWaitingForTaskCompleteFromAssignee(report, parentReportAction);
}
result.isArchivedRoom = ReportUtils.isArchivedRoom(report);
result.isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
Expand Down