diff --git a/src/hooks/useSidebarOrderedReports.tsx b/src/hooks/useSidebarOrderedReports.tsx index d38ea040deeb..93c3bb71aadf 100644 --- a/src/hooks/useSidebarOrderedReports.tsx +++ b/src/hooks/useSidebarOrderedReports.tsx @@ -86,7 +86,7 @@ function SidebarOrderedReportsContextProvider({ const [currentReportsToDisplay, setCurrentReportsToDisplay] = useState({}); const {shouldUseNarrowLayout} = useResponsiveLayout(); const {isOffline} = useNetwork(); - const {accountID} = useCurrentUserPersonalDetails(); + const {accountID, login: currentUserLogin} = useCurrentUserPersonalDetails(); const {currentReportID: currentReportIDValue} = useCurrentReportIDState(); const derivedCurrentReportID = currentReportIDForTests ?? currentReportIDValue; const prevDerivedCurrentReportID = usePrevious(derivedCurrentReportID); @@ -213,21 +213,25 @@ function SidebarOrderedReportsContextProvider({ draftComments: reportsDrafts, transactions, isOffline, + currentUserLogin: currentUserLogin ?? '', + currentUserAccountID: accountID, }); } else { Log.info('[useSidebarOrderedReports] building reportsToDisplay from scratch'); - reportsToDisplay = SidebarUtils.getReportsToDisplayInLHN( - derivedCurrentReportID, - chatReports, + reportsToDisplay = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: derivedCurrentReportID, + reports: chatReports, betas, priorityMode, - reportsDrafts, + draftComments: reportsDrafts, transactionViolations, transactions, isOffline, + currentUserLogin: currentUserLogin ?? '', + currentUserAccountID: accountID, reportNameValuePairs, reportAttributes, - ); + }); } return reportsToDisplay; @@ -245,6 +249,8 @@ function SidebarOrderedReportsContextProvider({ reportsDrafts, isOffline, clearCacheDummyCounter, + currentUserLogin, + accountID, ]); // Derive a stable boolean map indicating which reports have drafts. diff --git a/src/libs/DebugUtils.ts b/src/libs/DebugUtils.ts index 55db6e20867a..60add514f522 100644 --- a/src/libs/DebugUtils.ts +++ b/src/libs/DebugUtils.ts @@ -1416,6 +1416,8 @@ function getReasonForShowingRowInLHN({ isInFocusMode = false, betas = undefined, draftComment, + currentUserLogin, + currentUserAccountID, }: { report: OnyxEntry; chatReport: OnyxEntry; @@ -1425,6 +1427,8 @@ function getReasonForShowingRowInLHN({ isInFocusMode?: boolean; betas?: OnyxEntry; draftComment: string | undefined; + currentUserLogin?: string; + currentUserAccountID?: number; }): TranslationPaths | null { if (!report) { return null; @@ -1442,6 +1446,8 @@ function getReasonForShowingRowInLHN({ includeSelfDM: true, isReportArchived, draftComment, + currentUserLogin, + currentUserAccountID, }); if (!([CONST.REPORT_IN_LHN_REASONS.HAS_ADD_WORKSPACE_ROOM_ERRORS, CONST.REPORT_IN_LHN_REASONS.HAS_IOU_VIOLATIONS] as Array).includes(reason) && hasRBR) { diff --git a/src/libs/OptionsListUtils/index.ts b/src/libs/OptionsListUtils/index.ts index 5b0841bbb601..b78cf640bf66 100644 --- a/src/libs/OptionsListUtils/index.ts +++ b/src/libs/OptionsListUtils/index.ts @@ -2043,6 +2043,7 @@ function isValidReport(option: SearchOption, policy: OnyxEntry, isRestrictedToPreferredPolicy, preferredPolicyID, currentUserAccountID, + currentUserLogin, shouldAlwaysIncludeDM, isTimeRequest = false, } = config; @@ -2062,6 +2063,8 @@ function isValidReport(option: SearchOption, policy: OnyxEntry, includeDomainEmail, isReportArchived: option.private_isArchived, draftComment, + currentUserLogin, + currentUserAccountID, }); if (!shouldBeInOptionList) { @@ -2446,6 +2449,7 @@ function getValidOptions( includeDomainEmail, loginsToExclude: loginsToExcludeFromSuggestions, currentUserAccountID, + currentUserLogin: currentUserEmail, }, draftComment, chatReport, diff --git a/src/libs/OptionsListUtils/types.ts b/src/libs/OptionsListUtils/types.ts index 0c251c9d2e55..d0b8ae1a5bff 100644 --- a/src/libs/OptionsListUtils/types.ts +++ b/src/libs/OptionsListUtils/types.ts @@ -193,6 +193,7 @@ type IsValidReportsConfig = Pick< | 'isTimeRequest' > & { currentUserAccountID: number; + currentUserLogin: string; }; type GetOptionsConfig = { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index de9a88ae412d..fad95f095b8a 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -86,7 +86,6 @@ import {isEmptyObject, isEmptyValueObject} from '@src/types/utils/EmptyObject'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; import {getBankAccountFromID} from './actions/BankAccounts'; -import {getUserAccountID} from './actions/IOU'; import {unholdRequest} from './actions/IOU/Hold'; import { createDraftTransaction, @@ -4321,8 +4320,14 @@ function getReasonAndReportActionThatRequiresAttention( * @param option (report or optionItem) * @param parentReportAction (the report action the current report is a thread of) */ -function requiresAttentionFromCurrentUser(optionOrReport: OnyxEntry | OptionData, parentReportAction?: OnyxEntry, isReportArchived = false) { - return !!getReasonAndReportActionThatRequiresAttention(optionOrReport, getCurrentUserEmail() ?? '', getUserAccountID(), parentReportAction, isReportArchived); +function requiresAttentionFromCurrentUser( + optionOrReport: OnyxEntry | OptionData, + currentUserLogin: string, + currentUserAccountID: number, + parentReportAction?: OnyxEntry, + isReportArchived = false, +) { + return !!getReasonAndReportActionThatRequiresAttention(optionOrReport, currentUserLogin, currentUserAccountID, parentReportAction, isReportArchived); } /** @@ -9486,6 +9491,8 @@ type ShouldReportBeInOptionListParams = { doesReportHaveViolations: boolean; includeSelfDM?: boolean; login?: string; + currentUserLogin?: string; + currentUserAccountID?: number; includeDomainEmail?: boolean; isReportArchived: boolean | undefined; draftComment: string | undefined; @@ -9504,6 +9511,8 @@ function reasonForReportToBeInOptionList({ draftComment, includeSelfDM = false, login, + currentUserLogin, + currentUserAccountID, includeDomainEmail = false, isReportArchived, requiresAttention, @@ -9587,7 +9596,7 @@ function reasonForReportToBeInOptionList({ return CONST.REPORT_IN_LHN_REASONS.HAS_DRAFT_COMMENT; } - if (requiresAttention ?? requiresAttentionFromCurrentUser(report, undefined, isReportArchived)) { + if (requiresAttention ?? requiresAttentionFromCurrentUser(report, currentUserLogin ?? '', currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, undefined, isReportArchived)) { return CONST.REPORT_IN_LHN_REASONS.HAS_GBR; } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 4380becc5cf5..9db647aaef81 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -274,6 +274,8 @@ type ShouldDisplayReportInLHNParams = { isOffline: boolean; isReportArchived?: boolean; reportAttributes?: ReportAttributesDerivedValue['reports']; + currentUserLogin: string; + currentUserAccountID: number; }; function shouldDisplayReportInLHN({ @@ -288,6 +290,8 @@ function shouldDisplayReportInLHN({ isOffline, isReportArchived, reportAttributes, + currentUserAccountID, + currentUserLogin, }: ShouldDisplayReportInLHNParams) { if (!report) { return {shouldDisplay: false}; @@ -345,23 +349,40 @@ function shouldDisplayReportInLHN({ includeSelfDM: true, isReportArchived, requiresAttention, + currentUserLogin, + currentUserAccountID, }); return {shouldDisplay}; } -function getReportsToDisplayInLHN( - currentReportId: string | undefined, - reports: OnyxCollection, - betas: OnyxEntry, - priorityMode: OnyxEntry, - draftComments: OnyxCollection, - transactionViolations: OnyxCollection, - transactions: OnyxCollection, - isOffline: boolean, - reportNameValuePairs?: OnyxCollection, - reportAttributes?: ReportAttributesDerivedValue['reports'], -) { +function getReportsToDisplayInLHN({ + currentReportId, + reports, + betas, + priorityMode, + draftComments, + transactionViolations, + transactions, + isOffline, + currentUserLogin, + currentUserAccountID, + reportNameValuePairs, + reportAttributes, +}: { + currentReportId: string | undefined; + reports: OnyxCollection; + betas: OnyxEntry; + priorityMode: OnyxEntry; + draftComments: OnyxCollection; + transactionViolations: OnyxCollection; + transactions: OnyxCollection; + isOffline: boolean; + currentUserLogin: string; + currentUserAccountID: number; + reportNameValuePairs?: OnyxCollection; + reportAttributes?: ReportAttributesDerivedValue['reports']; +}) { const isInFocusMode = priorityMode === CONST.PRIORITY_MODE.GSD; const allReportsDictValues = reports ?? {}; const reportsToDisplay: ReportsToDisplayInLHN = {}; @@ -385,6 +406,8 @@ function getReportsToDisplayInLHN( isOffline, isReportArchived: isArchivedReport(reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]), reportAttributes, + currentUserLogin, + currentUserAccountID, }); if (shouldDisplay) { @@ -410,6 +433,8 @@ type UpdateReportsToDisplayInLHNProps = { draftComments: OnyxCollection; transactions: OnyxCollection; isOffline: boolean; + currentUserLogin: string; + currentUserAccountID: number; }; function updateReportsToDisplayInLHN({ @@ -425,6 +450,8 @@ function updateReportsToDisplayInLHN({ draftComments, transactions, isOffline, + currentUserLogin, + currentUserAccountID, }: UpdateReportsToDisplayInLHNProps) { // Use a lazy copy to avoid creating a new object reference when no entries actually change. let displayedReportsCopy: ReportsToDisplayInLHN | undefined; @@ -460,6 +487,8 @@ function updateReportsToDisplayInLHN({ isOffline, isReportArchived: isArchivedReport(reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`] ?? {}), reportAttributes, + currentUserLogin, + currentUserAccountID, }); if (shouldDisplay) { diff --git a/src/libs/UnreadIndicatorUpdater/index.ts b/src/libs/UnreadIndicatorUpdater/index.ts index 272620e70b58..548cea2d76e1 100644 --- a/src/libs/UnreadIndicatorUpdater/index.ts +++ b/src/libs/UnreadIndicatorUpdater/index.ts @@ -8,10 +8,20 @@ import * as ReportUtils from '@libs/ReportUtils'; import Navigation, {navigationRef} from '@navigation/Navigation'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Report, ReportActions, ReportNameValuePairs} from '@src/types/onyx'; +import type {Report, ReportActions, ReportNameValuePairs, Session} from '@src/types/onyx'; import updateUnread from './updateUnread'; let allReports: OnyxCollection = {}; +let currentUserAccountID: number = CONST.DEFAULT_NUMBER_ID; +let currentUserLogin = ''; + +Onyx.connectWithoutView({ + key: ONYXKEYS.SESSION, + callback: (value: Session | undefined) => { + currentUserAccountID = value?.accountID ?? CONST.DEFAULT_NUMBER_ID; + currentUserLogin = value?.email ?? ''; + }, +}); let allReportNameValuePairs: OnyxCollection = {}; // This subscription is used to update the unread indicators count which is not linked to UI and it does not update any UI state. @@ -62,6 +72,8 @@ function getUnreadReportsForUnreadIndicator(reports: OnyxCollection, cur excludeEmptyChats: false, isReportArchived, draftComment, + currentUserLogin, + currentUserAccountID, }) && /** * Chats with hidden preference remain invisible in the LHN and are not considered "unread." diff --git a/src/libs/actions/IOU/MoneyRequestBuilder.ts b/src/libs/actions/IOU/MoneyRequestBuilder.ts index 6033d2c4a747..e6082701a445 100644 --- a/src/libs/actions/IOU/MoneyRequestBuilder.ts +++ b/src/libs/actions/IOU/MoneyRequestBuilder.ts @@ -66,7 +66,7 @@ import type ReportAction from '@src/types/onyx/ReportAction'; import type {OnyxData} from '@src/types/onyx/Request'; import type {Receipt, TransactionChanges, TransactionCustomUnit, WaypointCollection} from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import {getAllPersonalDetails, getAllReportActionsFromIOU, getAllReportNameValuePairs, getAllReports, getCurrentUserPersonalDetails, getUserAccountID} from './index'; +import {getAllPersonalDetails, getAllReportActionsFromIOU, getAllReportNameValuePairs, getAllReports, getCurrentUserPersonalDetails} from './index'; import type {ReplaceReceipt} from './Receipt'; import {getSearchOnyxUpdate} from './SearchUpdate'; import type {StartSplitBilActionParams} from './Split'; @@ -261,6 +261,7 @@ type BuildOnyxDataForTestDriveIOUParams = { iouOptimisticParams: MoneyRequestOptimisticParams['iou']; chatOptimisticParams: MoneyRequestOptimisticParams['chat']; testDriveCommentReportActionID?: string; + currentUserAccountIDParam: number; }; function buildMinimalTransactionForFormula( @@ -323,8 +324,6 @@ function getReceiptError( function buildOnyxDataForTestDriveIOU( testDriveIOUParams: BuildOnyxDataForTestDriveIOUParams, ): OnyxData { - const deprecatedUserAccountID = getUserAccountID(); - const deprecatedCurrentUserPersonalDetails = getCurrentUserPersonalDetails(); const optimisticData: Array> = []; const successData: Array> = []; const failureData: Array> = []; @@ -340,11 +339,11 @@ function buildOnyxDataForTestDriveIOU( transactionID: testDriveIOUParams.transaction.transactionID, reportActionID: testDriveIOUParams.iouOptimisticParams.action.reportActionID, }); - const text = translateLocal('testDrive.employeeInviteMessage', getAllPersonalDetails()?.[deprecatedUserAccountID]?.firstName ?? ''); + const text = translateLocal('testDrive.employeeInviteMessage', getAllPersonalDetails()?.[testDriveIOUParams.currentUserAccountIDParam]?.firstName ?? ''); // delegateAccountIDParam: will be threaded in PR 15; buildOptimisticAddCommentReportAction falls back to module-level Onyx.connect value (https://github.com/Expensify/App/issues/66425) const textComment = buildOptimisticAddCommentReportAction({ text, - actorAccountID: deprecatedUserAccountID, + actorAccountID: testDriveIOUParams.currentUserAccountIDParam, reportActionID: testDriveIOUParams.testDriveCommentReportActionID, delegateAccountIDParam: undefined, }); @@ -364,7 +363,7 @@ function buildOnyxDataForTestDriveIOU( value: { ...{lastActionType: CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED, statusNum: CONST.REPORT.STATUS_NUM.REIMBURSED}, hasOutstandingChildRequest: false, - lastActorAccountID: deprecatedCurrentUserPersonalDetails?.accountID, + lastActorAccountID: testDriveIOUParams.currentUserAccountIDParam, }, }, { @@ -618,6 +617,7 @@ function buildOnyxDataForMoneyRequest(moneyRequestParams: BuildOnyxDataForMoneyR iouOptimisticParams: iou, chatOptimisticParams: chat, testDriveCommentReportActionID, + currentUserAccountIDParam, }); onyxData.optimisticData?.push(...testDriveOptimisticData); onyxData.successData?.push(...testDriveSuccessData); diff --git a/src/libs/actions/IOU/SearchUpdate.ts b/src/libs/actions/IOU/SearchUpdate.ts index 74154397a217..cf9d238ba918 100644 --- a/src/libs/actions/IOU/SearchUpdate.ts +++ b/src/libs/actions/IOU/SearchUpdate.ts @@ -11,7 +11,7 @@ import type * as OnyxTypes from '@src/types/onyx'; import type {Participant} from '@src/types/onyx/IOU'; import type {OnyxData} from '@src/types/onyx/Request'; import type {SearchResultDataType} from '@src/types/onyx/SearchResults'; -import {getCurrentUserPersonalDetails, getUserAccountID} from './index'; +import {getCurrentUserPersonalDetails} from './index'; type ExpenseReportStatusPredicate = (expenseReport: OnyxEntry, transactionReportID?: string) => boolean; @@ -44,6 +44,7 @@ function shouldOptimisticallyUpdateSearch( currentSearchQueryJSON: Readonly, iouReport: OnyxEntry, isInvoice: boolean | undefined, + currentUserAccountID: number, transaction?: OnyxEntry, ) { if ( @@ -76,7 +77,7 @@ function shouldOptimisticallyUpdateSearch( return false; } - const suggestedSearches = getSuggestedSearches(getUserAccountID()); + const suggestedSearches = getSuggestedSearches(currentUserAccountID); const submitQueryJSON = suggestedSearches[CONST.SEARCH.SEARCH_KEYS.SUBMIT].searchQueryJSON; const approveQueryJSON = suggestedSearches[CONST.SEARCH.SEARCH_KEYS.APPROVE].searchQueryJSON; const unapprovedCashSimilarSearchHash = suggestedSearches[CONST.SEARCH.SEARCH_KEYS.UNAPPROVED_CASH].similarSearchHash; @@ -125,7 +126,7 @@ function getSearchOnyxUpdate({ return; } - if (shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, isInvoice, transaction)) { + if (shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, isInvoice, fromAccountID, transaction)) { const isOptimisticToAccountData = isOptimisticPersonalDetail(toAccountID); const successData = []; if (isOptimisticToAccountData) { diff --git a/src/libs/actions/IOU/index.ts b/src/libs/actions/IOU/index.ts index ef31a6e6cc41..7addf1cea3df 100644 --- a/src/libs/actions/IOU/index.ts +++ b/src/libs/actions/IOU/index.ts @@ -144,10 +144,6 @@ function getAllTransactionDrafts(): NonNullable { return deprecatedCurrentUserPersonalDetails; } @@ -223,7 +219,6 @@ export { getAllReportActionsFromIOU, getAllReportNameValuePairs, getAllTransactionDrafts, - getUserAccountID, getCurrentUserPersonalDetails, getRecentAttendees, // eslint-disable-next-line @typescript-eslint/no-deprecated diff --git a/src/pages/Debug/Report/DebugReportPage.tsx b/src/pages/Debug/Report/DebugReportPage.tsx index de6fa1130a0f..d2960b9b143c 100644 --- a/src/pages/Debug/Report/DebugReportPage.tsx +++ b/src/pages/Debug/Report/DebugReportPage.tsx @@ -117,6 +117,8 @@ function DebugReportPage({ isReportArchived, isInFocusMode: priorityMode === CONST.PRIORITY_MODE.GSD, draftComment, + currentUserLogin: currentUserLogin ?? '', + currentUserAccountID, }); return [ diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index 9e64803279cc..42eb7049aaf7 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -293,12 +293,12 @@ describe('actions/IOU', () => { const iouReport: Report = {...createRandomReport(2, undefined), type: CONST.REPORT.TYPE.EXPENSE, stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN}; // When the report is in draft status it should return true - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, transaction)).toBeTruthy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, RORY_ACCOUNT_ID, transaction)).toBeTruthy(); // If the report is not in draft state it should return false iouReport.stateNum = CONST.REPORT.STATE_NUM.SUBMITTED; iouReport.statusNum = CONST.REPORT.STATUS_NUM.SUBMITTED; - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, transaction)).toBeFalsy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, RORY_ACCOUNT_ID, transaction)).toBeFalsy(); }); it('when the current hash is approve action query it should only return true if the iou report is in outstanding state', () => { @@ -352,12 +352,12 @@ describe('actions/IOU', () => { const iouReport: Report = {...createRandomReport(2, undefined), type: CONST.REPORT.TYPE.EXPENSE, stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN}; // When the report is in draft status it should return false - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, transaction)).toBeFalsy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, RORY_ACCOUNT_ID, transaction)).toBeFalsy(); // If the report is in outstanding state it should return true iouReport.stateNum = CONST.REPORT.STATE_NUM.SUBMITTED; iouReport.statusNum = CONST.REPORT.STATUS_NUM.SUBMITTED; - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, transaction)).toBeTruthy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, RORY_ACCOUNT_ID, transaction)).toBeTruthy(); }); it('when the current hash is unapproved cash action query it should only return true if the iou report is in either draft or outstanding state', () => { @@ -396,12 +396,12 @@ describe('actions/IOU', () => { const iouReport: Report = {...createRandomReport(2, undefined), type: CONST.REPORT.TYPE.EXPENSE, stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN}; // When the report is in draft status it should return true - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, transaction)).toBeTruthy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, RORY_ACCOUNT_ID, transaction)).toBeTruthy(); // If the report is in approved state it should return false iouReport.stateNum = CONST.REPORT.STATE_NUM.APPROVED; iouReport.statusNum = CONST.REPORT.STATUS_NUM.APPROVED; - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, transaction)).toBeFalsy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, iouReport, false, RORY_ACCOUNT_ID, transaction)).toBeFalsy(); }); it('when the current hash includes a policyID filter it should only return true if the iou report matches the policyID filter', () => { @@ -439,7 +439,7 @@ describe('actions/IOU', () => { stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN, }; - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, matchingIOUReport, false, transaction)).toBeTruthy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, matchingIOUReport, false, RORY_ACCOUNT_ID, transaction)).toBeTruthy(); // When the IOU report has a different policyID, it should return false const nonMatchingIOUReport: Report = { @@ -449,7 +449,7 @@ describe('actions/IOU', () => { stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN, }; - expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, nonMatchingIOUReport, false, transaction)).toBeFalsy(); + expect(shouldOptimisticallyUpdateSearch(currentSearchQueryJSON, nonMatchingIOUReport, false, RORY_ACCOUNT_ID, transaction)).toBeFalsy(); }); }); diff --git a/tests/perf-test/SidebarUtils.perf-test.ts b/tests/perf-test/SidebarUtils.perf-test.ts index 8efb20580602..78061e67af3e 100644 --- a/tests/perf-test/SidebarUtils.perf-test.ts +++ b/tests/perf-test/SidebarUtils.perf-test.ts @@ -94,11 +94,39 @@ describe('SidebarUtils', () => { test('[SidebarUtils] getReportsToDisplayInLHN on 15k reports for default priorityMode', async () => { await waitForBatchedUpdates(); - await measureFunction(() => SidebarUtils.getReportsToDisplayInLHN(currentReportId, allReports, mockedBetas, CONST.PRIORITY_MODE.DEFAULT, {}, transactionViolations, {}, false)); + await measureFunction(() => + SidebarUtils.getReportsToDisplayInLHN({ + currentReportId, + reports: allReports, + betas: mockedBetas, + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: 1, + reportNameValuePairs: {}, + }), + ); }); test('[SidebarUtils] getReportsToDisplayInLHN on 15k reports for GSD priorityMode', async () => { await waitForBatchedUpdates(); - await measureFunction(() => SidebarUtils.getReportsToDisplayInLHN(currentReportId, allReports, mockedBetas, CONST.PRIORITY_MODE.GSD, {}, transactionViolations, {}, false)); + await measureFunction(() => + SidebarUtils.getReportsToDisplayInLHN({ + currentReportId, + reports: allReports, + betas: mockedBetas, + priorityMode: CONST.PRIORITY_MODE.GSD, + draftComments: {}, + transactionViolations, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: 1, + reportNameValuePairs: {}, + }), + ); }); }); diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 207c74c56869..2e1d8c873f5c 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -3239,7 +3239,7 @@ describe('ReportUtils', () => { }); it('returns false when there is no report', () => { - expect(requiresAttentionFromCurrentUser(undefined)).toBe(false); + expect(requiresAttentionFromCurrentUser(undefined, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns false when the matched IOU report does not have an owner accountID', () => { @@ -3247,7 +3247,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), ownerAccountID: undefined, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns false when the linked iou report has an outstanding IOU', () => { @@ -3259,7 +3259,7 @@ describe('ReportUtils', () => { reportID: '1', ownerAccountID: 99, }).then(() => { - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); }); @@ -3269,7 +3269,7 @@ describe('ReportUtils', () => { ownerAccountID: currentUserAccountID, isWaitingOnBankAccount: true, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns false when the report has outstanding IOU and is not waiting for a bank account and the logged user is the report owner', () => { @@ -3278,7 +3278,7 @@ describe('ReportUtils', () => { ownerAccountID: currentUserAccountID, isWaitingOnBankAccount: false, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns false when the report has no outstanding IOU but is waiting for a bank account and the logged user is not the report owner', () => { @@ -3287,7 +3287,7 @@ describe('ReportUtils', () => { ownerAccountID: 97, isWaitingOnBankAccount: true, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns true when the report has an unread mention', () => { @@ -3295,7 +3295,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), isUnreadWithMention: true, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns true for @here mention in an admin room', () => { @@ -3305,7 +3305,7 @@ describe('ReportUtils', () => { lastReadTime: '2024-03-01 12:00:00.000', lastMentionedTime: '2024-03-01 12:00:01.000', }; - expect(requiresAttentionFromCurrentUser(report)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns false for @here in an admin room when user already read after mention', () => { @@ -3315,7 +3315,7 @@ describe('ReportUtils', () => { lastReadTime: '2024-03-01 12:00:02.000', lastMentionedTime: '2024-03-01 12:00:01.000', }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns true when the report is an outstanding task', () => { @@ -3328,7 +3328,7 @@ describe('ReportUtils', () => { statusNum: CONST.REPORT.STATUS_NUM.OPEN, hasParentAccess: false, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns true when the report has outstanding child expense', () => { @@ -3338,7 +3338,7 @@ describe('ReportUtils', () => { hasOutstandingChildRequest: true, isWaitingOnBankAccount: false, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns false if the user is not on free trial', async () => { @@ -3352,7 +3352,7 @@ describe('ReportUtils', () => { chatType: CONST.REPORT.CHAT_TYPE.SYSTEM, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it("returns false if the user free trial hasn't ended yet", async () => { @@ -3366,7 +3366,7 @@ describe('ReportUtils', () => { chatType: CONST.REPORT.CHAT_TYPE.SYSTEM, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns true when expense report is awaiting current user approval without parent access', () => { @@ -3379,7 +3379,7 @@ describe('ReportUtils', () => { statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, }; - expect(requiresAttentionFromCurrentUser(report)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns false when awaiting approval but parent accessible or user is not approver', () => { @@ -3392,7 +3392,7 @@ describe('ReportUtils', () => { statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, }; - expect(requiresAttentionFromCurrentUser(reportWithParentAccess)).toBe(false); + expect(requiresAttentionFromCurrentUser(reportWithParentAccess, currentUserEmail, currentUserAccountID)).toBe(false); const reportWithDifferentManager = { ...LHNTestUtils.getFakeReport(), @@ -3403,7 +3403,7 @@ describe('ReportUtils', () => { statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, }; - expect(requiresAttentionFromCurrentUser(reportWithDifferentManager)).toBe(false); + expect(requiresAttentionFromCurrentUser(reportWithDifferentManager, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns false when expense report is awaiting user submission, delayed submission on > daily', async () => { @@ -3415,7 +3415,7 @@ describe('ReportUtils', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}1`, {reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL}); - expect(requiresAttentionFromCurrentUser(report)).toBe(false); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); }); it('returns false when expense report is awaiting user submission, delayed submission on > manually', async () => { @@ -3427,7 +3427,7 @@ describe('ReportUtils', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}1`, {reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL}); - expect(requiresAttentionFromCurrentUser(report)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns true for expense report awaiting submission with manual submit', async () => { @@ -3450,8 +3450,8 @@ describe('ReportUtils', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}1`, {reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL}); // The GBR should appear on the policy expense chat but not on the report itself - expect(requiresAttentionFromCurrentUser(report)).toBe(false); - expect(requiresAttentionFromCurrentUser(policyExpenseChat)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); + expect(requiresAttentionFromCurrentUser(policyExpenseChat, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns true for expense report awaiting user payment/reimbursement', async () => { @@ -3472,8 +3472,8 @@ describe('ReportUtils', () => { }; // The GBR should appear on the policy expense chat but not on the report itself - expect(requiresAttentionFromCurrentUser(report)).toBe(false); - expect(requiresAttentionFromCurrentUser(policyExpenseChat)).toBe(true); + expect(requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID)).toBe(false); + expect(requiresAttentionFromCurrentUser(policyExpenseChat, currentUserEmail, currentUserAccountID)).toBe(true); }); it('returns false and does not surface GBR when expense report is approved and reimbursement is enabled', async () => { @@ -3497,7 +3497,7 @@ describe('ReportUtils', () => { await waitForBatchedUpdates(); // When we evaluate if the report requires attention from the current user - const requiresAttention = requiresAttentionFromCurrentUser(report); + const requiresAttention = requiresAttentionFromCurrentUser(report, currentUserEmail, currentUserAccountID); // Then it should return false because the report is already approved and reimbursement is enabled expect(requiresAttention).toBe(false); @@ -12823,7 +12823,7 @@ describe('ReportUtils', () => { const reasonForAttention = getReasonAndReportActionThatRequiresAttention(expenseReport, currentUserEmail, currentUserAccountID, undefined, false); expect(reasonForAttention?.reason).toBe(CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION); - const requiresAttention = requiresAttentionFromCurrentUser(expenseReport, undefined, false); + const requiresAttention = requiresAttentionFromCurrentUser(expenseReport, currentUserEmail, currentUserAccountID, undefined, false); expect(requiresAttention).toBe(true); const reasonForOptionList = reasonForReportToBeInOptionList({ @@ -12866,7 +12866,7 @@ describe('ReportUtils', () => { const reasonForAttention = getReasonAndReportActionThatRequiresAttention(expenseReport, currentUserEmail, currentUserAccountID, undefined, false); expect(reasonForAttention?.reason).toBe(undefined); - const requiresAttention = requiresAttentionFromCurrentUser(expenseReport, undefined, false); + const requiresAttention = requiresAttentionFromCurrentUser(expenseReport, currentUserEmail, currentUserAccountID, undefined, false); expect(requiresAttention).toBe(false); const reasonForOptionList = reasonForReportToBeInOptionList({ @@ -16495,7 +16495,7 @@ describe('ReportUtils', () => { expect(getOutstandingChildRequest(expenseReport).hasOutstandingChildRequest).toBe(true); // GBR shows on the workspace chat - expect(requiresAttentionFromCurrentUser(policyExpenseChat)).toBe(true); + expect(requiresAttentionFromCurrentUser(policyExpenseChat, currentUserEmail, currentUserAccountID)).toBe(true); const reason = reasonForReportToBeInOptionList({ report: policyExpenseChat, @@ -16564,7 +16564,7 @@ describe('ReportUtils', () => { expect(getOutstandingChildRequest(expenseReport)).toEqual({}); // The workspace chat still has hasOutstandingChildRequest: true, so GBR persists - expect(requiresAttentionFromCurrentUser(policyExpenseChat)).toBe(true); + expect(requiresAttentionFromCurrentUser(policyExpenseChat, currentUserEmail, currentUserAccountID)).toBe(true); const reason = reasonForReportToBeInOptionList({ report: policyExpenseChat, diff --git a/tests/unit/SidebarUtilsTest.ts b/tests/unit/SidebarUtilsTest.ts index b042ebcd5e95..8c392deaf74b 100644 --- a/tests/unit/SidebarUtilsTest.ts +++ b/tests/unit/SidebarUtilsTest.ts @@ -899,6 +899,8 @@ describe('SidebarUtils', () => { draftComment: undefined, transactions: MOCK_TRANSACTIONS, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toStrictEqual({shouldDisplay: true, hasErrorsOtherThanFailedReceipt: true}); @@ -1008,6 +1010,8 @@ describe('SidebarUtils', () => { draftComment: undefined, transactions: MOCK_TRANSACTIONS, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toStrictEqual({shouldDisplay: true, hasErrorsOtherThanFailedReceipt: true}); @@ -1024,6 +1028,8 @@ describe('SidebarUtils', () => { draftComment: undefined, transactions: {}, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toStrictEqual({shouldDisplay: false}); @@ -1043,6 +1049,8 @@ describe('SidebarUtils', () => { draftComment: undefined, transactions: {}, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toStrictEqual({shouldDisplay: false}); @@ -1064,6 +1072,8 @@ describe('SidebarUtils', () => { draftComment: undefined, transactions: {}, isOffline: true, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toBeDefined(); @@ -1086,6 +1096,8 @@ describe('SidebarUtils', () => { draftComment: undefined, transactions: {}, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toBeDefined(); @@ -3824,6 +3836,8 @@ describe('SidebarUtils', () => { reportAttributes: undefined, draftComments: {}, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).toBe(displayedReports); @@ -3846,6 +3860,8 @@ describe('SidebarUtils', () => { reportAttributes: undefined, draftComments: {}, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).not.toBe(displayedReports); @@ -3855,35 +3871,39 @@ describe('SidebarUtils', () => { describe('getReportsToDisplayInLHN', () => { it('should return an empty object when reports is undefined', () => { - const result = SidebarUtils.getReportsToDisplayInLHN( - '1', // currentReportId - undefined, // reports - [], // betas - CONST.PRIORITY_MODE.DEFAULT, // priorityMode - {}, // draftComments - {}, // transactionViolations - {}, // transactions - false, // isOffline - {}, // reportNameValuePairs - undefined, // reportAttributes - ); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: '1', + reports: undefined as unknown as OnyxCollection, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations: {}, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); expect(result).toEqual({}); }); it('should return an empty object when reports is empty', () => { - const result = SidebarUtils.getReportsToDisplayInLHN( - '1', // currentReportId - {}, // reports - [], // betas - CONST.PRIORITY_MODE.DEFAULT, // priorityMode - {}, // draftComments - {}, // transactionViolations - {}, // transactions - false, // isOffline - {}, // reportNameValuePairs - undefined, // reportAttributes - ); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: '1', + reports: {}, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations: {}, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); expect(result).toEqual({}); }); @@ -3893,7 +3913,20 @@ describe('SidebarUtils', () => { [`${ONYXKEYS.COLLECTION.REPORT}1`]: undefined, }; - const result = SidebarUtils.getReportsToDisplayInLHN('1', reports, [], CONST.PRIORITY_MODE.DEFAULT, {}, {}, {}, false, {}, undefined); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: '1', + reports, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations: {}, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); expect(result).toEqual({}); }); @@ -3907,7 +3940,20 @@ describe('SidebarUtils', () => { [`${ONYXKEYS.COLLECTION.REPORT}1`]: report, }; - const result = SidebarUtils.getReportsToDisplayInLHN('1', reports, [], CONST.PRIORITY_MODE.DEFAULT, {}, {}, {}, false, {}, undefined); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: '1', + reports, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations: {}, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); // The function should run without errors with isOffline=false expect(result).toBeDefined(); @@ -3922,7 +3968,20 @@ describe('SidebarUtils', () => { [`${ONYXKEYS.COLLECTION.REPORT}1`]: report, }; - const result = SidebarUtils.getReportsToDisplayInLHN('1', reports, [], CONST.PRIORITY_MODE.DEFAULT, {}, {}, {}, true, {}, undefined); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: '1', + reports, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations: {}, + transactions: {}, + isOffline: true, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); // The function should run without errors with isOffline=true expect(result).toBeDefined(); @@ -3937,7 +3996,20 @@ describe('SidebarUtils', () => { [`${ONYXKEYS.COLLECTION.REPORT}1`]: report, }; - const result = SidebarUtils.getReportsToDisplayInLHN('1', reports, [], CONST.PRIORITY_MODE.DEFAULT, {}, {}, {}, false, {}, undefined); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: '1', + reports, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments: {}, + transactionViolations: {}, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); expect(result[`${ONYXKEYS.COLLECTION.REPORT}1`]).toBeUndefined(); }); @@ -3962,7 +4034,20 @@ describe('SidebarUtils', () => { [`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}1`]: 'draft for report 1', }; - const result = SidebarUtils.getReportsToDisplayInLHN(undefined, reports, [], CONST.PRIORITY_MODE.DEFAULT, draftComments, {}, {}, false, {}, undefined); + const result = SidebarUtils.getReportsToDisplayInLHN({ + currentReportId: undefined, + reports, + betas: [], + priorityMode: CONST.PRIORITY_MODE.DEFAULT, + draftComments, + transactionViolations: {}, + transactions: {}, + isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, + reportNameValuePairs: {}, + reportAttributes: undefined, + }); // Should not throw and should return a valid result expect(result).toBeDefined(); @@ -3989,6 +4074,8 @@ describe('SidebarUtils', () => { reportAttributes: undefined, draftComments: {}, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); // No changes expected since the updated key doesn't exist in reports @@ -4014,6 +4101,8 @@ describe('SidebarUtils', () => { reportAttributes: undefined, draftComments: {}, isOffline: true, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); // No changes expected since the updated key doesn't exist in reports @@ -4037,6 +4126,8 @@ describe('SidebarUtils', () => { reportAttributes: undefined, draftComments: {}, isOffline: true, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); expect(result).not.toBe(displayedReports); @@ -4071,6 +4162,8 @@ describe('SidebarUtils', () => { reportAttributes: undefined, draftComments, isOffline: false, + currentUserLogin: CURRENT_USER_LOGIN, + currentUserAccountID: CURRENT_USER_ACCOUNT_ID, }); // Should not throw and should return a valid result