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

Corrected the Wrong edit user details error #1075

Closed
wants to merge 1 commit into from
Closed

Corrected the Wrong edit user details error #1075

wants to merge 1 commit into from

Conversation

umangachapagain
Copy link

@umangachapagain umangachapagain commented Oct 6, 2018

tendrl-bug-id: /issues/1070
bugzilla-id: 1633542
Signed-off-by: Umanga Chapagain [email protected]

@umangachapagain umangachapagain requested review from a team as code owners October 6, 2018 06:21
@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

1 similar comment
@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@cloudbehl
Copy link
Member

@umangachapagain what is this PR about? why does it has 9 commits?
I think you have not rebased properly.

can you please go through this book Pro Git(https://git-scm.com/book/en/v2). That will be good.

@gnehapk
Copy link
Member

gnehapk commented Oct 6, 2018

@umangachapagain There needs to be a bugzilla created for this issue and once the bugzilla gets acked, after that only this PR can be merged. Please rebase and attach bugzilla id to the PR as well.

@umangachapagain
Copy link
Author

@gnehapk @cloudbehl I have rebased and attached the bugzilla id. Please verify.

@@ -65,7 +65,10 @@
vm.errorMsg = "Please enter a valid Email Id";
}
} else if (keys.indexOf("name") !== -1) {
vm.errorMsg = "Name is too short (minimum is 4 characters).";
if(messages.indexOf("is too short (minimum is 4 characters)") !== -1)
Copy link
Member

Choose a reason for hiding this comment

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

not in favor of doing character/string machine to show an error. Easy way to handle this is with below example.

else if (keys.indexOf("name") !== -1) {
    vm.errorMsg = messages;
}

Also, I am not in favor of checking this kind of error messages from the API. Before doing an API call we should test this on client side and validate. because I think these are simple validations and can be handled on UI side Easily. @gnehapk thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

@umangachapagain Can you please handle this validation from the client side so that API errors do not need to be checked.

Copy link
Author

Choose a reason for hiding this comment

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

Ok. Working on it.

if(form.name.$dirty && form.name.$error.maxlength){
vm.errorMsg = "Name is too long (maximum 20 characters).";
isFormValid = false;
} else if (form.name.$invalid) {
Copy link
Author

Choose a reason for hiding this comment

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

Is there a case where "form.name.$invalid" is reached?

Copy link
Member

Choose a reason for hiding this comment

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

@umangachapagain why you think it will not?

I think when user will try to submit form without name it will show this error? what you think

Copy link
Author

Choose a reason for hiding this comment

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

can user submit form without name?
Because we have minlength of 4 and maxlength of 20, whenever user types anything smaller than 4 characters, i get an inbuilt error prompt that says "Extend name to 4 characters" and when its longer than 20 characters, we throw a "Name is too long" error.

any thing other than minlength and maxlength could be caught here, but as I see it, there are no other restrictions on name. I can even write a whole script as my name and it will accept it as long as length requirement is satisfied.

@umangachapagain
Copy link
Author

@gnehapk Reverted to previous fix. Please review.

if(messages.indexOf("is too short (minimum is 4 characters)") !== -1)
vm.errorMsg = "Name is too short (minimum is 4 characters).";
else if(messages.indexOf("is too long (maximum is 20 characters)") !== -1)
vm.errorMsg = "Name is too long (maximum 20 characters).";
Copy link
Member

Choose a reason for hiding this comment

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

@umangachapagain you have missed "is" in the error message. It should be - Name is too long (maximum is 20 characters).

@umangachapagain
Copy link
Author

@gnehapk @cloudbehl

gnehapk
gnehapk previously approved these changes Oct 18, 2018
cloudbehl
cloudbehl previously approved these changes Oct 18, 2018
@umangachapagain umangachapagain dismissed stale reviews from cloudbehl and gnehapk via dd738f3 October 22, 2018 07:31
@gnehapk
Copy link
Member

gnehapk commented Oct 23, 2018

@TimothyAsirJeyasing the codacy CI build for this PR is on waiting state. Can you please check?

@dahorak
Copy link
Contributor

dahorak commented Oct 24, 2018

run build

gnehapk
gnehapk previously approved these changes Oct 24, 2018
@gnehapk gnehapk requested a review from a2batic October 25, 2018 01:51
tendrl-bug-id: /issues/1070
bugzilla-id: 1633542
Signed-off-by: Umanga Chapagain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants