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

[Backend] Handle errors and flash messages editing a taxon #3574

Merged
merged 1 commit into from
Apr 17, 2020

Conversation

softr8
Copy link
Contributor

@softr8 softr8 commented Apr 2, 2020

Description

If there was any error when trying to edit a taxon, it
was not showing any error and just redirecting to taxons index,
this change renders edit form showing errors correctly instead
of just redirect without any flash message.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

If there was any error when trying to edit a taxon, it
was not showing any error and just redirecting to taxons index,
this change renders edit form showing errors correctly instead
of just redirect without any flash message.
@@ -189,7 +189,7 @@ module Spree
end

it "cannot create a new taxon with invalid attributes" do
post spree.api_taxonomy_taxons_path(taxonomy), params: { taxon: { foo: :bar } }
post spree.api_taxonomy_taxons_path(taxonomy), params: { taxon: { name: '' } }
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about the reason why for this change, can you explain to me? thanks 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was passing due the wrong check, it was actually passing because foo is not a permitted param, and using name it actually runs the validations

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, @softr8!! 🎉

@kennyadsl kennyadsl changed the title Improving taxon edit [Backend] Handle errors and flash messages editing a taxon Apr 17, 2020
@kennyadsl kennyadsl added changelog:solidus_backend Changes to the solidus_backend gem Code Review Needed labels Apr 17, 2020
@aldesantis aldesantis merged commit 874d54f into solidusio:master Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants