Skip to content

Commit 7eba98d

Browse files
authored
Merge pull request Expensify#64641 from bernhardoj/fix/64004-rbr-is-shown-in-iou-confirm-page-participant
Don't show rbr for participants in iou confirm page
2 parents 755b505 + 581db07 commit 7eba98d

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

src/libs/OptionsListUtils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ type GetValidReportsConfig = {
224224
shouldSeparateSelfDMChat?: boolean;
225225
excludeNonAdminWorkspaces?: boolean;
226226
isPerDiemRequest?: boolean;
227+
showRBR?: boolean;
227228
} & GetValidOptionsSharedConfig;
228229

229230
type GetValidReportsReturnTypeCombined = {
@@ -1051,6 +1052,7 @@ function getReportOption(participant: Participant): OptionData {
10511052
option.isDisabled = isDraftReport(participant.reportID);
10521053
option.selected = participant.selected;
10531054
option.isSelected = participant.selected;
1055+
option.brickRoadIndicator = null;
10541056
return option;
10551057
}
10561058

@@ -1614,6 +1616,7 @@ function getValidReports(reports: OptionList['reports'], config: GetValidReports
16141616
shouldSeparateWorkspaceChat,
16151617
excludeNonAdminWorkspaces,
16161618
isPerDiemRequest = false,
1619+
showRBR = true,
16171620
} = config;
16181621
const topmostReportId = Navigation.getTopmostReportId();
16191622

@@ -1759,6 +1762,7 @@ function getValidReports(reports: OptionList['reports'], config: GetValidReports
17591762
isSelected,
17601763
isBold,
17611764
lastIOUCreationDate,
1765+
brickRoadIndicator: showRBR ? option.brickRoadIndicator : null,
17621766
};
17631767

17641768
if (shouldSeparateWorkspaceChat && newReportOption.isOwnPolicyExpenseChat && !newReportOption.private_isArchived) {

src/pages/iou/request/MoneyRequestParticipantsSelector.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ function MoneyRequestParticipantsSelector({
183183
includeSelfDM: !isMovingTransactionFromTrackExpense(action) && iouType !== CONST.IOU.TYPE.INVOICE,
184184
canShowManagerMcTest: !hasBeenAddedToNudgeMigration && action !== CONST.IOU.ACTION.SUBMIT,
185185
isPerDiemRequest,
186+
showRBR: false,
186187
},
187188
);
188189

tests/unit/OptionsListUtilsTest.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,98 @@ describe('OptionsListUtils', () => {
804804
// Then the result should include the admin room
805805
expect(adminRoomOption).toBeDefined();
806806
});
807+
808+
it('should include brickRoadIndicator if showRBR is true', () => {
809+
const reportID = '1455140530846319';
810+
const workspaceChat: SearchOption<Report> = {
811+
item: {
812+
chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT,
813+
currency: 'USD',
814+
errorFields: {},
815+
lastActionType: 'CREATED',
816+
lastReadTime: '2025-03-21 07:25:46.279',
817+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
818+
lastVisibleActionLastModified: '2024-12-15 21:13:24.317',
819+
ownerAccountID: 0,
820+
permissions: ['read', 'write'],
821+
participants: {1: {notificationPreference: 'always'}},
822+
policyID: '52A5ABD88FBBD18F',
823+
policyName: "A's Workspace",
824+
reportID,
825+
reportName: "A's Workspace chat",
826+
type: 'chat',
827+
writeCapability: 'all',
828+
},
829+
text: "A's Workspace chat",
830+
alternateText: "A's Workspace",
831+
allReportErrors: {},
832+
subtitle: "A's Workspace",
833+
participantsList: [],
834+
reportID,
835+
keyForList: '1455140530846319',
836+
isDefaultRoom: true,
837+
isChatRoom: true,
838+
policyID: '52A5ABD88FBBD18F',
839+
lastMessageText: '',
840+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
841+
notificationPreference: 'hidden',
842+
brickRoadIndicator: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR,
843+
};
844+
const results = getValidOptions(
845+
{reports: [workspaceChat], personalDetails: []},
846+
{
847+
includeMultipleParticipantReports: true,
848+
showRBR: true,
849+
},
850+
);
851+
expect(results.recentReports.at(0)?.brickRoadIndicator).toBe(CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR);
852+
});
853+
854+
it('should not include brickRoadIndicator if showRBR is false', () => {
855+
const reportID = '1455140530846319';
856+
const workspaceChat: SearchOption<Report> = {
857+
item: {
858+
chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT,
859+
currency: 'USD',
860+
errorFields: {},
861+
lastActionType: 'CREATED',
862+
lastReadTime: '2025-03-21 07:25:46.279',
863+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
864+
lastVisibleActionLastModified: '2024-12-15 21:13:24.317',
865+
ownerAccountID: 0,
866+
permissions: ['read', 'write'],
867+
participants: {1: {notificationPreference: 'always'}},
868+
policyID: '52A5ABD88FBBD18F',
869+
policyName: "A's Workspace",
870+
reportID,
871+
reportName: "A's Workspace chat",
872+
type: 'chat',
873+
writeCapability: 'all',
874+
},
875+
text: "A's Workspace chat",
876+
alternateText: "A's Workspace",
877+
allReportErrors: {},
878+
subtitle: "A's Workspace",
879+
participantsList: [],
880+
reportID,
881+
keyForList: '1455140530846319',
882+
isDefaultRoom: true,
883+
isChatRoom: true,
884+
policyID: '52A5ABD88FBBD18F',
885+
lastMessageText: '',
886+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
887+
notificationPreference: 'hidden',
888+
brickRoadIndicator: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR,
889+
};
890+
const results = getValidOptions(
891+
{reports: [workspaceChat], personalDetails: []},
892+
{
893+
includeMultipleParticipantReports: true,
894+
showRBR: false,
895+
},
896+
);
897+
expect(results.recentReports.at(0)?.brickRoadIndicator).toBe(null);
898+
});
807899
});
808900

809901
describe('getValidOptions() for chat room', () => {

0 commit comments

Comments
 (0)