-
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
Paypal username field validation #5842
Paypal username field validation #5842
Conversation
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.
Code tests well, but there are two typos that need to be addressed.
src/languages/en.js
Outdated
@@ -282,6 +282,7 @@ export default { | |||
addPayPalAccount: 'Add PayPal account', | |||
editPayPalAccount: 'Update PayPal account', | |||
growlMessageOnSave: 'Your PayPal username was successfully added', | |||
formatError: 'Invalid PayPa.me username', |
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.
Missing an l
— should be PayPal.me
src/languages/es.js
Outdated
@@ -282,6 +282,7 @@ export default { | |||
addPayPalAccount: 'Agregar cuenta de PayPal', | |||
growlMessageOnSave: 'Su nombre de usuario de PayPal se agregó correctamente', | |||
editPayPalAccount: 'Actualizar cuenta de PayPal', | |||
formatError: 'Usuario PayPa.me no válido', |
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.
Also missing the l
in PayPal
@deetergp PR updated. Typos fixed. Sorry about that. |
@akshayasalvi Typos happen — no big deal! |
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.
Few changes. @deetergp Please wait before the merge.
@@ -282,6 +282,7 @@ export default { | |||
addPayPalAccount: 'Add PayPal account', | |||
editPayPalAccount: 'Update PayPal account', | |||
growlMessageOnSave: 'Your PayPal username was successfully added', | |||
formatError: 'Invalid PayPal.me username', |
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.
NAB: Sorry for being Nit-picky. but this does not sound friendly. You can ask this on Slack.
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've asked, lets see if we get any response. Any suggestions from your side?
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 am not really good with content but this is not really blocking this so if you don't get any feedback, then it's 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.
Okay got it. Thanks for the help.
* | ||
* @returns {Boolean} | ||
*/ | ||
validatePaypalMeUsername() { |
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.
Let's move this to ValidationUtils.js
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.
Done
@@ -92,6 +114,9 @@ class AddPayPalMePage extends React.Component { | |||
placeholder={this.props.translate('addPayPalMePage.yourPayPalUsername')} | |||
onChangeText={text => this.setState({payPalMeUsername: text})} | |||
returnKeyType="done" | |||
hasError={this.state.payPalMeUsernameError} | |||
errorText={this.state.payPalMeUsernameError ? this.props.translate('addPayPalMePage.formatError') : ''} | |||
|
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 can remove this empty line.
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.
Done
@@ -92,6 +114,9 @@ class AddPayPalMePage extends React.Component { | |||
placeholder={this.props.translate('addPayPalMePage.yourPayPalUsername')} | |||
onChangeText={text => this.setState({payPalMeUsername: text})} |
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 clear the error on the onChangeText
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.
done
@akshayasalvi Could you please add |
@parasharrajat @deetergp PR updated |
src/libs/ValidationUtils.js
Outdated
* @returns {Boolean} | ||
*/ | ||
function isValidPaypalUsername(paypalUsername) { | ||
return paypalUsername && CONST.REGEX.PAYPAL_ME_USERNAME.test(paypalUsername); |
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.
A minor change as this condition does not always return boolean. when paypalUsername
is ''
.
If someone used this in JSX, It will crash the app. Better to convert paypalUsername
in boolean.
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.
Well thinking more about it, should I change it to:
!paypalUsername || CONST.REGEX.PAYPAL_ME_USERNAME.test(paypalUsername)
Current behavior to remove the username is deleting the content.
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.
Well. I think @stitesExpensify can help here with it. Thanks for bringing this up.
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.
Yeah I don't think we should add the !paypalUsername
since I'm adding a way to delete it right now
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.
Thanks for the comment @stitesExpensify
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.
@parasharrajat I've updated the Regex instead by changing * to +. Let me know if that's 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.
Yup. that's 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.
This one is remaining.
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.
Done now.
@parasharrajat Any changes required in this PR? |
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.
LGTM. Tests well.
Ready for final review and possibly merge cc: @deetergp
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.
Looks good, thanks for the changes. There was a merge conflict on the list of exports from src/libs/ValidationUtils.js which I resolved. It dismissed @parasharrajat's review, but since that export list is the only thing that changed since his last approval, I am going to go ahead and merge before we end up with another merge conflict.
Edit: There's also a [HOLD]
on it. That needs to be removed before I can merge.
@deetergp Thank you for resolving the conflict. The |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by @roryabraham in version: 1.1.10-2 🚀
|
cc - @parasharrajat
Details
Fixed Issues
$ #5541
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android