diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 6b15ba58e587..91bc75d89339 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -225,6 +225,7 @@ type GetValidReportsConfig = { shouldSeparateSelfDMChat?: boolean; excludeNonAdminWorkspaces?: boolean; isPerDiemRequest?: boolean; + showRBR?: boolean; } & GetValidOptionsSharedConfig; type GetValidReportsReturnTypeCombined = { @@ -1049,6 +1050,7 @@ function getReportOption(participant: Participant): OptionData { option.isDisabled = isDraftReport(participant.reportID); option.selected = participant.selected; option.isSelected = participant.selected; + option.brickRoadIndicator = null; return option; } @@ -1584,6 +1586,7 @@ function getValidReports(reports: OptionList['reports'], config: GetValidReports shouldSeparateWorkspaceChat, excludeNonAdminWorkspaces, isPerDiemRequest = false, + showRBR = true, } = config; const topmostReportId = Navigation.getTopmostReportId(); @@ -1730,6 +1733,7 @@ function getValidReports(reports: OptionList['reports'], config: GetValidReports isSelected, isBold, lastIOUCreationDate, + brickRoadIndicator: showRBR ? option.brickRoadIndicator : null, }; if (shouldSeparateWorkspaceChat && newReportOption.isOwnPolicyExpenseChat && !newReportOption.private_isArchived) { diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index d270f0fc5c98..fd537e919c27 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -187,6 +187,7 @@ function MoneyRequestParticipantsSelector({ includeSelfDM: !isMovingTransactionFromTrackExpense(action) && iouType !== CONST.IOU.TYPE.INVOICE, canShowManagerMcTest: !hasBeenAddedToNudgeMigration && action !== CONST.IOU.ACTION.SUBMIT, isPerDiemRequest, + showRBR: false, }, ); diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index bea0aed94b5b..4132b61aac71 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -801,6 +801,98 @@ describe('OptionsListUtils', () => { // Then the result should include the admin room expect(adminRoomOption).toBeDefined(); }); + + it('should include brickRoadIndicator if showRBR is true', () => { + const reportID = '1455140530846319'; + const workspaceChat: SearchOption = { + item: { + chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, + currency: 'USD', + errorFields: {}, + lastActionType: 'CREATED', + lastReadTime: '2025-03-21 07:25:46.279', + lastVisibleActionCreated: '2024-12-15 21:13:24.317', + lastVisibleActionLastModified: '2024-12-15 21:13:24.317', + ownerAccountID: 0, + permissions: ['read', 'write'], + participants: {1: {notificationPreference: 'always'}}, + policyID: '52A5ABD88FBBD18F', + policyName: "A's Workspace", + reportID, + reportName: "A's Workspace chat", + type: 'chat', + writeCapability: 'all', + }, + text: "A's Workspace chat", + alternateText: "A's Workspace", + allReportErrors: {}, + subtitle: "A's Workspace", + participantsList: [], + reportID, + keyForList: '1455140530846319', + isDefaultRoom: true, + isChatRoom: true, + policyID: '52A5ABD88FBBD18F', + lastMessageText: '', + lastVisibleActionCreated: '2024-12-15 21:13:24.317', + notificationPreference: 'hidden', + brickRoadIndicator: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, + }; + const results = getValidOptions( + {reports: [workspaceChat], personalDetails: []}, + { + includeMultipleParticipantReports: true, + showRBR: true, + }, + ); + expect(results.recentReports.at(0)?.brickRoadIndicator).toBe(CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR); + }); + + it('should not include brickRoadIndicator if showRBR is false', () => { + const reportID = '1455140530846319'; + const workspaceChat: SearchOption = { + item: { + chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, + currency: 'USD', + errorFields: {}, + lastActionType: 'CREATED', + lastReadTime: '2025-03-21 07:25:46.279', + lastVisibleActionCreated: '2024-12-15 21:13:24.317', + lastVisibleActionLastModified: '2024-12-15 21:13:24.317', + ownerAccountID: 0, + permissions: ['read', 'write'], + participants: {1: {notificationPreference: 'always'}}, + policyID: '52A5ABD88FBBD18F', + policyName: "A's Workspace", + reportID, + reportName: "A's Workspace chat", + type: 'chat', + writeCapability: 'all', + }, + text: "A's Workspace chat", + alternateText: "A's Workspace", + allReportErrors: {}, + subtitle: "A's Workspace", + participantsList: [], + reportID, + keyForList: '1455140530846319', + isDefaultRoom: true, + isChatRoom: true, + policyID: '52A5ABD88FBBD18F', + lastMessageText: '', + lastVisibleActionCreated: '2024-12-15 21:13:24.317', + notificationPreference: 'hidden', + brickRoadIndicator: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, + }; + const results = getValidOptions( + {reports: [workspaceChat], personalDetails: []}, + { + includeMultipleParticipantReports: true, + showRBR: false, + }, + ); + expect(results.recentReports.at(0)?.brickRoadIndicator).toBe(null); + }); }); describe('getValidOptions() for chat room', () => {