Skip to content

Commit 1a0d813

Browse files
authored
Merge pull request Expensify#94104 from emkhalid/fix-92431-track-workspace-admin-lhn
Fix #admin room visibility in LHN for Track Workspace onboarding
2 parents 241d30f + e0dc897 commit 1a0d813

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9565,6 +9565,7 @@ function reasonForReportToBeInOptionList({
95659565
isEmptyChat &&
95669566
isChatReport(report) &&
95679567
!isPolicyExpenseChat(report) &&
9568+
!isAdminRoom(report) &&
95689569
!isTripRoom(report) &&
95699570
!isConciergeChatReport(report) &&
95709571
!isSystemChatReport &&

src/libs/SidebarUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ import {
171171
isAnnounceRoom,
172172
isArchivedNonExpenseReport,
173173
isArchivedReport,
174+
isChatReport,
174175
isChatRoom,
175176
isChatThread,
176177
isConciergeChatReport,
@@ -335,6 +336,7 @@ function shouldDisplayReportInLHN({
335336
isFocused ||
336337
isSystemChat ||
337338
!!report.isPinned ||
339+
(isChatReport(report) && isAdminRoom(report)) ||
338340
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
339341
requiresAttention ||
340342
(report.isOwnPolicyExpenseChat && !isReportArchived);

tests/unit/ReportUtilsTest.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7045,6 +7045,29 @@ describe('ReportUtils', () => {
70457045
).toBeTruthy();
70467046
});
70477047

7048+
it('should return true for empty admin room even when excludeEmptyChats is true', () => {
7049+
const report: Report = {
7050+
...createAdminRoom(1),
7051+
participants: buildParticipantsFromAccountIDs([1, 2]),
7052+
lastMessageText: '',
7053+
lastVisibleActionCreated: DateUtils.getDBTime(),
7054+
};
7055+
7056+
expect(
7057+
shouldReportBeInOptionList({
7058+
report,
7059+
chatReport: mockedChatReport,
7060+
currentReportId: '',
7061+
isInFocusMode: false,
7062+
betas: [CONST.BETAS.DEFAULT_ROOMS],
7063+
doesReportHaveViolations: false,
7064+
excludeEmptyChats: true,
7065+
draftComment: '',
7066+
isReportArchived: undefined,
7067+
}),
7068+
).toBeTruthy();
7069+
});
7070+
70487071
it('should return false when the report has an unsupported type', () => {
70497072
const report: Report = {
70507073
...LHNTestUtils.getFakeReport(),

0 commit comments

Comments
 (0)