Skip to content

Commit

Permalink
Merge pull request #11634 from Expensify/john-fix-no-comment-reports
Browse files Browse the repository at this point in the history
Only show reports without comments if they are non-archived policy rooms

(cherry picked from commit bc5ceff)
  • Loading branch information
tgolen authored and OSBotify committed Oct 6, 2022
1 parent 94f6fc6 commit f411797
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,9 +929,9 @@ function shouldReportBeInOptionList(report, reportIDFromRoute, isInGSDMode, curr
}

// Exclude reports that don't have any comments
// Archived rooms or user created policy rooms are OK to show when the don't have any comments
// User created policy rooms are OK to show when the don't have any comments, only if they aren't archived.
const hasNoComments = report.lastMessageTimestamp === 0;
if (hasNoComments && (isArchivedRoom(report) || isUserCreatedPolicyRoom(report))) {
if (hasNoComments && (isArchivedRoom(report) || !isUserCreatedPolicyRoom(report))) {
return false;
}

Expand Down
19 changes: 9 additions & 10 deletions tests/unit/LHNFilterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,16 @@ describe('Sidebar', () => {

// Given these combinations of booleans which result in the report being filtered out (not shown).
const booleansWhichRemovesInactiveReport = [
// isUserCreatedPolicyRoom
JSON.stringify([false, false, true, false, false, false, false]),
JSON.stringify([false, false, false, false, false, false, false]),

// isUserCreatedPolicyRoom, isUnread
JSON.stringify([false, false, true, false, true, false, false]),
// isUnread
JSON.stringify([false, false, false, false, true, false, false]),

// isUserCreatedPolicyRoom, hasAddWorkspaceError
JSON.stringify([false, false, true, true, false, false, false]),
// hasAddWorkspaceError, isUnread
JSON.stringify([false, false, false, true, true, false, false]),

// isUserCreatedPolicyRoom, hasAddWorkspaceError, isUnread
JSON.stringify([false, false, true, true, true, false, false]),
// hasAddWorkspaceError
JSON.stringify([false, false, false, true, false, false, false]),

// isArchived
JSON.stringify([false, true, false, false, false, false, false]),
Expand Down Expand Up @@ -563,10 +562,10 @@ describe('Sidebar', () => {
const booleansWhichRemovesInactiveReport = [
JSON.stringify([false, false, false, false, false, false, false]),
JSON.stringify([false, false, false, true, false, false, false]),
JSON.stringify([false, false, false, false, true, false, false]),
JSON.stringify([false, false, false, true, true, false, false]),
JSON.stringify([false, false, true, false, false, false, false]),
JSON.stringify([false, false, true, false, true, false, false]),
JSON.stringify([false, false, true, true, false, false, false]),
JSON.stringify([false, false, true, true, true, false, false]),
JSON.stringify([false, true, false, false, false, false, false]),
JSON.stringify([false, true, false, false, true, false, false]),
JSON.stringify([false, true, false, true, false, false, false]),
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/OptionsListUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ describe('OptionsListUtils', () => {
// Then the 2 personalDetails that don't have reports should be returned
expect(results.personalDetails.length).toBe(2);

// Then all of the reports should be shown, including the one that has no message on them.
expect(results.recentReports.length).toBe(_.size(REPORTS));
// Then all of the reports should be shown EXCEPT the archived room, including the one that has no message on them.
expect(results.recentReports.length).toBe(_.size(REPORTS) - 1);

// When we filter again but provide a searchValue
results = OptionsListUtils.getSearchOptions(REPORTS, PERSONAL_DETAILS, 'spider');
Expand Down

0 comments on commit f411797

Please sign in to comment.