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
4 changes: 4 additions & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ type GetValidReportsConfig = {
shouldSeparateSelfDMChat?: boolean;
excludeNonAdminWorkspaces?: boolean;
isPerDiemRequest?: boolean;
showRBR?: boolean;
} & GetValidOptionsSharedConfig;

type GetValidReportsReturnTypeCombined = {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1584,6 +1586,7 @@ function getValidReports(reports: OptionList['reports'], config: GetValidReports
shouldSeparateWorkspaceChat,
excludeNonAdminWorkspaces,
isPerDiemRequest = false,
showRBR = true,
} = config;
const topmostReportId = Navigation.getTopmostReportId();

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function MoneyRequestParticipantsSelector({
includeSelfDM: !isMovingTransactionFromTrackExpense(action) && iouType !== CONST.IOU.TYPE.INVOICE,
canShowManagerMcTest: !hasBeenAddedToNudgeMigration && action !== CONST.IOU.ACTION.SUBMIT,
isPerDiemRequest,
showRBR: false,
},
);

Expand Down
92 changes: 92 additions & 0 deletions tests/unit/OptionsListUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Report> = {
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<Report> = {
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', () => {
Expand Down