Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
waterim committed Dec 11, 2023
1 parent 88bee57 commit a4dcc97
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1531,14 +1531,14 @@ function isWaitingForAssigneeToCompleteTask(report: OnyxEntry<Report>, parentRep
return isTaskReport(report) && isReportManager(report) && isOpenTaskReport(report, parentReportAction);
}

function isUnreadWithMention(report: OnyxEntry<Report> | OptionData): boolean {
if (!report) {
function isUnreadWithMention(reportOrOption: OnyxEntry<Report> | OptionData): boolean {
if (!reportOrOption) {
return false;
}
// lastMentionedTime and lastReadTime are both datetime strings and can be compared directly
const lastMentionedTime = report.lastMentionedTime ?? '';
const lastReadTime = report.lastReadTime ?? '';
return Boolean('isUnreadWithMention' in report && report.isUnreadWithMention) || lastReadTime < lastMentionedTime;
const lastMentionedTime = reportOrOption.lastMentionedTime ?? '';
const lastReadTime = reportOrOption.lastReadTime ?? '';
return Boolean('isUnreadWithMention' in reportOrOption && reportOrOption.isUnreadWithMention) || lastReadTime < lastMentionedTime;
}

/**
Expand All @@ -1550,25 +1550,25 @@ function isUnreadWithMention(report: OnyxEntry<Report> | OptionData): boolean {
* @param option (report or optionItem)
* @param parentReportAction (the report action the current report is a thread of)
*/
function requiresAttentionFromCurrentUser(option: OnyxEntry<Report> | OptionData, parentReportAction: EmptyObject | OnyxEntry<ReportAction> = {}) {
if (!option) {
function requiresAttentionFromCurrentUser(optionOrReport: OnyxEntry<Report> | OptionData, parentReportAction: EmptyObject | OnyxEntry<ReportAction> = {}) {
if (!optionOrReport) {
return false;
}

if (isArchivedRoom(option) || isArchivedRoom(getReport(option.parentReportID))) {
if (isArchivedRoom(optionOrReport) || isArchivedRoom(getReport(optionOrReport.parentReportID))) {
return false;
}

if (isUnreadWithMention(option)) {
if (isUnreadWithMention(optionOrReport)) {
return true;
}

if (isWaitingForAssigneeToCompleteTask(option, parentReportAction)) {
if (isWaitingForAssigneeToCompleteTask(optionOrReport, parentReportAction)) {
return true;
}

// Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user
if (option.hasOutstandingChildRequest) {
if (optionOrReport.hasOutstandingChildRequest) {
return true;
}

Expand Down

0 comments on commit a4dcc97

Please sign in to comment.