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

Make rating mandatory #197

Merged
merged 6 commits into from Feb 6, 2024

Conversation

leemyongpakvn
Copy link
Contributor

Questions Answers
Description? Make rating mandatory. Please check detail in related issue.
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop/PrestaShop#26001
How to test? Apply PR changes then check to make sure that Review with Empty Title, Name, Content or not chosen Rating won't be accepted.
(Don't forget to use a clean dev branch, FO - clear Browser cache, BO - clear PS cache before testing ;)

@leemyongpakvn leemyongpakvn marked this pull request as draft January 20, 2024 11:30
@leemyongpakvn leemyongpakvn marked this pull request as ready for review January 21, 2024 01:03
Copy link
Contributor

@matthieu-rolland matthieu-rolland left a comment

Choose a reason for hiding this comment

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

thank you for taking care of this 👍

there is no backend validation for this rating mechanism ?

@leemyongpakvn
Copy link
Contributor Author

leemyongpakvn commented Jan 23, 2024

@matthieu-rolland No, this PR just add rating not Chosen check like Review's title, author and content Empty check in the same front-end validation function validateFormData. Furthermore, ratingChosen variable is set programmatically (not by a user input) and won't be saved to DB, so there is no need for back-end validation.

Copy link
Contributor

@florine2623 florine2623 left a comment

Choose a reason for hiding this comment

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

Hello @leemyongpakvn ,

On classic theme it works like expected.

Screenshot 2024-01-23 at 14 27 42

Although, I think the color should be the same red as the red in the message alert :
Screenshot 2024-01-23 at 14 34 09

Also, it should the vertically alight to the right.

But on hummingbird, it doesn't work.

Could you make it compatible for both themes ?

Screen.Recording.2024-01-23.at.14.30.55.mov

Could you check ? :)
Thanks!

@florine2623 florine2623 removed their assignment Jan 23, 2024
@leemyongpakvn
Copy link
Contributor Author

@florine2623 ratingNotChosen message's Color and Alignment are changed following your suggestion. An implementation of this PR for hummingbird theme is also added PrestaShop/hummingbird#577.

@paulnoelcholot
Copy link

Hello @leemyongpakvn,

I tested your PR on classic theme and hummingbird and I got this :
image
image

Can you check it please?

Thanks!

@leemyongpakvn
Copy link
Contributor Author

@paulnoelcholot Did you remember to apply FO - clear Browser cache, BO - clear PS cache before testing ?

@AureRita
Copy link

Hi @leemyongpakvn

Thank you for your PR, I tested it and it seems to works as you can see :

recording.79.webm

Unfortunately, you can also see that if you clic again on "Write your review" after put none rate on the product, you still have "* Please choose a rating for your review."

Can you check it ?

Thank you

@leemyongpakvn
Copy link
Contributor Author

@AureRita I saw and fixed it with my 5th commit. Please check again.

@AureRita
Copy link

Thank you for your changes, now the problem is on the other way, when you put a rate, press send (to have the message that is hidden) close the modal and want to write a new review without rate, you didn't have the error message, as you can see :

recording.81.webm

Waiting for your next changes 🚀

Thank you

@leemyongpakvn
Copy link
Contributor Author

@AureRita In the scenario: when you put a rate, press send OR just close the modal without send, then try to make a new review without rate it means you are already aware of the need to put a rate. So it can be a nuisance when keeping the warning message there :) Wdyt @MatShir ?

Copy link
Contributor

@matks matks left a comment

Choose a reason for hiding this comment

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

Code is good for me 👍

@leemyongpakvn
Copy link
Contributor Author

@AureRita As discussed in Slack, Krystian agreed with you, so I have changed the code following your opinion. Please check again.

@MatShir
Copy link

MatShir commented Feb 5, 2024

@leemyongpakvn thanks for making the effort 🤗
Late answer (sorry), Consistent error message for a better UX is always appreciated

@AureRita AureRita self-assigned this Feb 5, 2024
Copy link

@AureRita AureRita left a comment

Choose a reason for hiding this comment

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

Hi @leemyongpakvn

Thank you for your PR, I tested it and it seems to works as you can see :

recording.91.webm

Because the PR seems to works as expected on develop and 8.1.x, It's QA ✔️

Thank you for all your best efforts ! 🚀

@leemyongpakvn
Copy link
Contributor Author

Thanks to all ;)

@leemyongpakvn leemyongpakvn merged commit f2f4d1f into PrestaShop:dev Feb 6, 2024
8 checks passed
@leemyongpakvn leemyongpakvn added this to the 6.0.3 milestone Feb 6, 2024
@florine2623 florine2623 mentioned this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
9 participants