-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add the Recents and Contacts headers to the single-user participants page used in the Request Money and New Chat flows #2818
Add the Recents and Contacts headers to the single-user participants page used in the Request Money and New Chat flows #2818
Conversation
…page used in the Request Money and New Chat flows
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
src/libs/Permissions.js
Outdated
return _.contains(betas, CONST.BETAS.IOU) || canUseAllBetas(); | ||
// return _.contains(betas, CONST.BETAS.IOU) || canUseAllBetas(); | ||
return true; | ||
} |
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.
Please revert this
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.
reverted
src/pages/NewChatPage.js
Outdated
sections.push({ | ||
title: this.props.translate('iou.recents'), | ||
data: this.state.recentReports, | ||
shouldShow: this.state.recentReports.length > 0, |
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.
!_.isEmpty
would be preferred here (example)
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.
I just changed the code.
And I noticed that OptionsSelector ignores shouldShow condition but it requires it as prop.
tests/unit/OptionsListUtilsTest.js
Outdated
// We should expect maxmimum of 5 recent reports to be returned | ||
// minus the currently logged in user and recent reports count |
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.
Not sure that this is correct.
We should expect maxmimum of 5 recent reports to be returned minus the currently logged in user and recent reports count
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.
I think this is two different things, no?
- Recent reports should have a max of 5
personalDetails
--> all the personalDetails should be returned minus the currently logged in user and recent reports count
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.
I got inspired by getNewGroupOptions() test and I think this is correct
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.
I think it was previously two different comments that have been merged into one?
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.
The code is fine
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.
What I meant here is that there should be two separate comments, but I think you have combined them into one.
// We should expect maxmimum of 5 recent reports to be returned --> this is referring to `recentReports`
// minus the currently logged in user and recent reports count --> why would the `recentReports` count be `X - 5 - logged in user`?
I think it should say this:
// We should expect maxmimum of 5 recent reports to be returned
// We should expect all personalDetails to be returned, minus the currently logged in user and recent reports count
Does that make sense?
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.
Yes, I refactored the commenting
tests/unit/OptionsListUtilsTest.js
Outdated
expect(results.personalDetails.length).toBe(1); | ||
expect(results.personalDetails[0].text).toBe('Spider-Man'); | ||
expect(results.recentReports.length).toBe(1); | ||
expect(results.recentReports[0].text).toBe('Spider-Man'); | ||
|
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.
We should test both instead of replacing the old personalDetails
test
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.
Now I expect personalDetails to be empty
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.
Now I expect personalDetails to be empty
Could we add that as a test case then?
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.
Yes, here it is.
tests/unit/OptionsListUtilsTest.js
Outdated
expect(results.personalDetails.length).toBe(_.size(PERSONAL_DETAILS_WITH_CONCIERGE) - 2); | ||
expect(results.personalDetails.length).toBe(_.size(PERSONAL_DETAILS_WITH_CONCIERGE) - 2 - 5); |
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.
5 is used quite a lot, can we add a test that returns less than 5 recentReports
?
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.
@kakajann can you create a var for 5, something like let maxRecentReports = 5;
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.
5 is used quite a lot, can we add a test that returns less than 5 recentReports?
In this line, we are testing recentReports
that returns less than 5.
@kakajann can you create a var for 5, something like let maxRecentReports = 5;
Of course, I did add a file-level constant variable for maxRecentReports in my last push
…Reports and the personalDetails
…io504-add-recents-to-search-options
Hi @kakajann, some of the automated tests are failing. I'll take another look at the PR once these are passing. |
Hello. I fixed the issue that failing |
@kakajann please resolve the final check by following this comment: #2818 (comment) |
I have read the CLA Document and I hereby sign the CLA |
…io504-add-recents-to-search-options
@kakajann the CI checks are still failing |
…io504-add-recents-to-search-options
Sorry, I don't wanna keep bothering you but I tested everything in local and found no issue. Also, my another PR is somehow passes every checks. |
Looks like your last push resolved the checks somehow. there's just a few additional comments to resolve. |
src/pages/NewChatPage.js
Outdated
@@ -77,10 +80,17 @@ class NewChatPage extends Component { | |||
getSections() { | |||
const sections = []; | |||
|
|||
sections.push({ | |||
title: this.props.translate('iou.recents'), |
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.
Now that we're using this String for non-IOU pages, I think it should be refactored to a different group. Could you move the iou.contacts
and iou.recents
to common.contacts
and common.recents
please.
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.
Yes I moved
Details
We are now consistently show the
recents
andcontacts
headers on the participant selector pages across all four of these flows:Request Money
,Split Bill
,New Chat
and NewGroup
.Fixed Issues
Fixed #2760
Tests
+
icon on the home screen to access the CreateMenuRequest Money
3. Enter an amount and clicknext
to access the single-user picker on the IOUParticipants pageOR
+
icon on the home screen to access the CreateMenuNew Chat
to access the single-user picker on the Participants pageQA Steps
See above
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android