-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude empty chats (with no ADDCOMMENT actions or message drafts) from LNH #19321
Merged
luacmartins
merged 49 commits into
main
from
paulogasparsv-exclude-empty-chats-from-lnh
Aug 13, 2023
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
4c79b7e
Exclude empty chat reports from LNH
aa395b7
Fix typo in isChatReport call
ce42cfc
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
872a064
Add empty chat LNH test to SidebarFilterTest
b6aaafb
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
9896a54
Add excludeEmptyChats logic to shouldReportBeInOptionList
8c4344f
Exclude threads, default rooms and policy rooms from empty chat logic…
1345009
Add another test to SidebarFilterTest for reports with drafts that sh…
b20f5b9
Fix policy expense beta test in SidebarFilterTest
9142120
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
a1d349d
Linting
9e7e220
Fix empty chat with draft LNH test
3ba65be
Add lastMessageText to SideBarOrderTest reports so they show in LNH
a7777ed
Change LNH empty chat check order
45c7b60
Do not include groups in logic that excludes empty chats from LNH
1af5873
Fix group chat check for excluding empty chats from newDot
74b557a
Lint ReportUtils
7bd4aff
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
70c93d3
Exclude empty group chats from the LNH
2e8178c
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
b119af9
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
7283708
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
d529c54
Lint ReportUtils
1e97d17
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
7f9a53f
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
8a7971e
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
784532f
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
03fa3e9
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
066dceb
Fixing tests by using lastMessageText instead of lastMessageHtml
6161296
Fix new sidebarFilterTest tests
1e93d7b
Lint tests
3a3277d
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
31c76ab
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
8576cd0
Replace getChatByParticipantsByLoginList call with getChatByParticipa…
14d2c27
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
c26cfdc
Undo previous change in navigateToAndOpenReport and call navigateToAn…
5bbaad3
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
91135bf
Reintroduce excludeEmptyChats logic
311ef9a
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
f05a02a
Reintroduce navigateToAndOpenReport login navigation
9c45580
Use getLastVisibleMessage to check for empty chats in shouldReportBeI…
aa01aff
Reuse isEmptyChat for empty chat threads check in shouldReportBeInOpt…
d9d1a7e
Fix typo and lint
b90eb07
Remove duplicated and faulty logic that hides empty threads
27cfda3
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
32e84ec
Fix SidebarOrderTest tests
382691b
Keep empty policy expense chats in LNH
d059564
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
ef0b220
Merge branch 'main' of github.com:Expensify/App into paulogasparsv-ex…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import wrapOnyxWithWaitForPromisesToResolve from '../utils/wrapOnyxWithWaitForPr | |
import CONST from '../../src/CONST'; | ||
import DateUtils from '../../src/libs/DateUtils'; | ||
import * as Localize from '../../src/libs/Localize'; | ||
import * as Report from '../../src/libs/actions/Report'; | ||
|
||
// Be sure to include the mocked permissions library or else the beta tests won't work | ||
jest.mock('../../src/libs/Permissions'); | ||
|
@@ -71,7 +72,59 @@ describe('Sidebar', () => { | |
); | ||
}); | ||
|
||
it('includes or excludes policy expense chats depending on the beta', () => { | ||
it('excludes an empty chat report', () => { | ||
LHNTestUtils.getDefaultRenderedSidebarLinks(); | ||
|
||
// Given a new report | ||
const report = LHNTestUtils.getFakeReport(['[email protected]', '[email protected]'], 0); | ||
|
||
return ( | ||
waitForPromisesToResolve() | ||
// When Onyx is updated to contain that report | ||
.then(() => | ||
Onyx.multiSet({ | ||
[`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`]: report, | ||
}), | ||
) | ||
|
||
// Then no reports are rendered in the LHN | ||
.then(() => { | ||
const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); | ||
const displayNames = screen.queryAllByLabelText(hintText); | ||
expect(displayNames).toHaveLength(0); | ||
}) | ||
); | ||
}); | ||
|
||
it('includes an empty chat report if it has a draft', () => { | ||
LHNTestUtils.getDefaultRenderedSidebarLinks(); | ||
|
||
// Given a new report | ||
const report = { | ||
...LHNTestUtils.getFakeReport([1, 2], 0), | ||
hasDraft: true, | ||
}; | ||
|
||
return ( | ||
waitForPromisesToResolve() | ||
// When Onyx is updated to contain that report | ||
.then(() => | ||
Onyx.multiSet({ | ||
[`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`]: report, | ||
[ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, | ||
}), | ||
) | ||
|
||
// Then no reports are rendered in the LHN | ||
.then(() => { | ||
const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); | ||
const displayNames = screen.queryAllByLabelText(hintText); | ||
expect(displayNames).toHaveLength(1); | ||
}) | ||
); | ||
}); | ||
|
||
it('includes or excludes policy expensechats depending on the beta', () => { | ||
LHNTestUtils.getDefaultRenderedSidebarLinks(); | ||
|
||
// Given a policy expense report | ||
|
@@ -92,6 +145,9 @@ describe('Sidebar', () => { | |
}), | ||
) | ||
|
||
// When the report has at least one ADDCOMMENT action to be rendered in the LNH | ||
.then(() => Report.addComment(report.reportID, 'Hi, this is a comment')) | ||
|
||
// Then no reports are rendered in the LHN | ||
.then(() => { | ||
const hintText = Localize.translateLocal('accessibilityHints.navigatesToChat'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably copy / pasta error? Should be "The report is rendered in the LHN"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, thks for catching that!
I'll create a P.R. to fix that unit test that is failing + fix that comment.