Skip to content
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

fix: adding value length check for full name field #1242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DmytroAlipov
Copy link
Contributor

@DmytroAlipov DmytroAlipov commented Apr 23, 2024

Description

Fixing an error when a new user tries registering on the platform with a full name longer than 255 characters.

500

Now the request to the backend will not be sent because validation fails:

no_created

I also created a MR#34577 to Platform so that the backend would not miss such errors. But validation on the backend is just a fuse. It’s better not to send an invalid request to the backend.

@DmytroAlipov DmytroAlipov requested a review from a team as a code owner April 23, 2024 12:52
@openedx-webhooks
Copy link

openedx-webhooks commented Apr 23, 2024

Thanks for the pull request, @DmytroAlipov!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/2u-infinity. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 23, 2024
@DmytroAlipov DmytroAlipov added the bug Report of or fix for something that isn't working as intended label Apr 23, 2024
@mphilbrick211
Copy link

Hi @openedx/2u-vanguards! This is all set for review.

@mphilbrick211
Copy link

Hi @openedx/2u-vanguards! This is all set for review.

Friendly follow-up on this, @openedx/2u-vanguards!

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.70%. Comparing base (52c6efc) to head (ae32491).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1242      +/-   ##
==========================================
- Coverage   87.94%   87.70%   -0.25%     
==========================================
  Files         139      124      -15     
  Lines        2812     2301     -511     
  Branches      839      643     -196     
==========================================
- Hits         2473     2018     -455     
+ Misses        324      274      -50     
+ Partials       15        9       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mphilbrick211
Copy link

Hi @openedx/vanguards @openedx/2u-vanguards - checking in on this.

Copy link
Contributor

@syedsajjadkazmii syedsajjadkazmii left a comment

Choose a reason for hiding this comment

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

Changes look good. Thanks

@@ -126,6 +126,11 @@ const messages = defineMessages({
defaultMessage: 'Enter a valid name',
description: 'Validation message that appears when fullname contain URL',
},
'name.validation.length.message': {
id: 'name.validation.message',
defaultMessage: 'Full name can not be longer than 255 symbols',
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need product approval on this message copy? If we don't, then maybe we can have an error message as for username field.
Full name must be between 1 and 255 characters?

Not sure but please let me know if my comment makes sense

@@ -94,6 +94,25 @@ describe('NameField', () => {
);
});

it('should check for long full name error', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('should check for long full name error', () => {
it('should validate for full name length', () => {

@DmytroAlipov DmytroAlipov requested a review from a team as a code owner October 14, 2024 05:50
@DmytroAlipov
Copy link
Contributor Author

Hi @farhaanbukhsh !
Yes, that's what I wanted to fix! Thanks!
But there's also a fix I made to the platform openedx/edx-platform#34577

@farhaanbukhsh
Copy link
Member

yes @DmytroAlipov !

The validation is already being done using

dispatch(fetchRealtimeValidations({ name: value }));

This is a server side call which calls /v1/validation/registration so either we should remove this in favor of client side validation or maybe have an action of disabling the submit button till all validation pass through.

Possibly 🤔

The real bug 🐛 is not disabling the submit button on validation issues. What do you say?

@DmytroAlipov
Copy link
Contributor Author

@farhaanbukhsh yes, I agree.
We can either disable the button on the frontend until validation is passed or fix the validation on the backend. However, handling everything on the frontend seems more logical. This approach would make the system's behavior more expected and predictable for the user.

Copy link

@awais-ansari awais-ansari left a comment

Choose a reason for hiding this comment

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

Small nits.

@@ -126,6 +126,11 @@ const messages = defineMessages({
defaultMessage: 'Enter a valid name',
description: 'Validation message that appears when fullname contain URL',
},
'name.validation.length.message': {
id: 'name.validation.message',
defaultMessage: 'Full name can not be longer than 255 symbols',

Choose a reason for hiding this comment

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

Hi @DmytroAlipov, I coordinated with the product. Product suggestion is to use Full name cannot be longer than 255 characters Message.

Copy link
Contributor Author

@DmytroAlipov DmytroAlipov Dec 3, 2024

Choose a reason for hiding this comment

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

@awais-ansari
✅ done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@awais-ansari I don't understand why the codecov failed

@DmytroAlipov DmytroAlipov force-pushed the fix-name-max-lenght branch 5 times, most recently from 724049a to 4b7c089 Compare December 3, 2024 08:49
@DmytroAlipov
Copy link
Contributor Author

I can't figure out why my coverage has decreased.

@mphilbrick211 mphilbrick211 requested a review from a team December 9, 2024 20:57
@mphilbrick211
Copy link

Hi @openedx/2u-infinity! Can someone please help out?

'name.validation.length.message': {
id: 'name.validation.message',
defaultMessage: 'Full name cannot be longer than 255 characters',
description: 'Validation message that appears when fullname contain URL',

Choose a reason for hiding this comment

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

description is not correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of or fix for something that isn't working as intended open-source-contribution PR author is not from Axim or 2U
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

6 participants