Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const CONST = {
},
MESSAGES: {
// eslint-disable-next-line max-len
NO_CONTACTS_FOUND: 'Don\'t see who you\'re looking for? Type their email or phone number to invite them to chat.',
NO_PHONE_NUMBER: 'Please enter a phone number including the country code e.g +447814266907',
MAXIMUM_PARTICIPANTS_REACHED: 'You\'ve reached the maximum number of participants for a group chat.',
},
PRIORITY_MODE: {
Expand Down
9 changes: 7 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,21 @@ function getSidebarOptions(reports, personalDetails, draftComments, activeReport
*
* @param {Boolean} hasSelectableOptions
* @param {Boolean} hasUserToInvite
* @param {String} searchValue
* @param {Boolean} [maxParticipantsReached]
* @return {String}
*/
function getHeaderMessage(hasSelectableOptions, hasUserToInvite, maxParticipantsReached = false) {
function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, maxParticipantsReached = false) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change a method signature we must update all usages. 🙃

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, I've just checked it.
I've thought the only newChat function.
Your concern can be solved easily by adding a props(this.state.searchValue) in the NewGroupPage.js.
image
Thanks.

if (maxParticipantsReached) {
return CONST.MESSAGES.MAXIMUM_PARTICIPANTS_REACHED;
}

if (!hasSelectableOptions && !hasUserToInvite) {
return CONST.MESSAGES.NO_CONTACTS_FOUND;
if (/^\d+$/.test(searchValue)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this check if it starts with a 0 ? I don't see it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right.
If it starts with a '0', the country code validation function runs. The function exist already in source code.
Thanks for your kindness.

return CONST.MESSAGES.NO_PHONE_NUMBER;
}

return searchValue;
}

return '';
Expand Down
1 change: 1 addition & 0 deletions src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class NewChatPage extends Component {
const headerMessage = getHeaderMessage(
this.state.personalDetails.length !== 0,
Boolean(this.state.userToInvite),
this.state.searchValue,
);

return (
Expand Down