-
Notifications
You must be signed in to change notification settings - Fork 93
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
TypeError on addCommentGrades in case of empty request #132
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.
Hi @clotairer,
I checked this PR with 178x branch & develop branch.
I have the same behavior.
Steps to reproduce the behavior:
- Install the Module
- Go to FO > Sign in
- View a product > for example id_product = 6
- Add a comment
- Go to BO > Module manager > Configure
productcomments
module & approve the comment - No try to navigate to this link:
shop.com/en/module/productcomments/PostComment?id_product=6
- the json request => ok but I need a confirmation about the result
{"success":false,"errors":["Title cannot be empty","Criterions not available"]}
Because
In the BO > Module manager > Configure productcomments
module
I have two criteria
The first is created by default, and the second is created by me
As I understand from this link: https://github.com/PrestaShop/productcomments/pull/132/files#diff-348aae0600a167b478b48da3c072ab70f44976f523d50f298f9857eece26375bR206-R208
We should have this message Criterions not available
only when the criteria is empty
I'm not sure what is the exact behavior.
Ping @PrestaShop/product-team what do you think?
Thanks!
I merge $this->validateComment($productComment) and $this->validateCriterions($criterions)to show all errors on the front in the same time (more friendly for the customer). The case have not cover is :
|
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.
Hi @clotairer,
Thanks for your feedback.
I checked with @Progi1984, we confirm the JSON result.
I tested with 178x branch & develop branch => OK ✔️
Untitled_.Feb.9.2022.5_33.PM.mp4
We have four cases:
- Not connected +
Allow guest reviews
disabled
=>{"success":false,"error":"You need to be <a href=\"http:\/\/0.0.0.0:8081\/178x\/en\/my-account\">logged in<\/a> or <a href=\"http:\/\/0.0.0.0:8081\/178x\/en\/login?create_account=1\">create an account<\/a> to post your review."}
- Not connected +
Allow guest reviews
enabled
=>{"success":false,"errors":["Title cannot be empty","Customer name cannot be empty","Criterions not available"]}
- Connected
=>{"success":false,"errors":["Title cannot be empty","Criterions not available"]}
- When we add a review >
Minimum time between 2 reviews from the same user
=>{"success":false,"error":"You are not allowed to post a review at the moment, please try again later."}
Thanks!
Thanks @clotairer & @khouloudbelguith |
Even if the form has a method POST, some bot crawl this URL and error 500 append :
I realized that validation are not done properly and after the persistence of data and criterions are not done.
The response code should be 200