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

Use Address name attribute in views and APIs #3524

Merged
merged 6 commits into from
Mar 6, 2020

Conversation

filippoliverani
Copy link
Contributor

@filippoliverani filippoliverani commented Feb 25, 2020

Description
This PR is a step to solve #3234 and a continuation of #3458

The PR allows to start using the new Spree::Address#name attribute instead of firstname and lastname by adding a show_address_deprecated_attributes preference and providing alternate HTML and JSON views.
The old attributes are not deprecated yet, but this PR discourages their usage and enables name usage everywhere.

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)

@filippoliverani filippoliverani marked this pull request as ready for review February 25, 2020 14:19
Copy link
Contributor

@ericsaupe ericsaupe left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

Great stuff again, but I left some other notes. Let me know what do you think!

frontend/spec/features/checkout_spec.rb Outdated Show resolved Hide resolved
backend/app/views/spree/admin/orders/index.html.erb Outdated Show resolved Hide resolved
api/app/helpers/spree/api/api_helpers.rb Outdated Show resolved Hide resolved
backend/app/controllers/spree/admin/search_controller.rb Outdated Show resolved Hide resolved
@filippoliverani filippoliverani force-pushed the switch-to-address-name branch from e446ac9 to 4fd8b3b Compare March 2, 2020 09:45
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, @filippoliverani. This thing is becoming a reality!

@filippoliverani
Copy link
Contributor Author

Thanks, @filippoliverani. This thing is becoming a reality!

Thank you for your help @kennyadsl! 💪

@kennyadsl
Copy link
Member

@filippoliverani can you check the conflict here. I can't recall merging something in that file lately.. 🤔

Favor name attribute usage over firstname and lastname.
To avoid internally relying on deprecated code for backwards
compatibility, deprecated fields are rendered in API responses only
when `show_deprecated_attributes` preference is set to true.
Favor name attribute usage over firstname and lastname attributes.
To avoid internally relying on deprecated code for backwards
compatibility, deprecated fields are rendered in HTML views instead of
name field only when `show_deprecated_attributes` preference is set to
true.
Favor name attribute usage in backend over firstname and lastname.
To avoid internally relying on deprecated code for backwards
compatibility, deprecated fields are rendered in HTML views and API
responses instead of name field only when `show_deprecated_attributes`
preference is set to true.
@filippoliverani filippoliverani force-pushed the switch-to-address-name branch from 6bb63de to 8b43d28 Compare March 6, 2020 08:52
@filippoliverani
Copy link
Contributor Author

@filippoliverani can you check the conflict here. I can't recall merging something in that file lately.. 🤔
Generators has been renamed recently, rebased 👍

@kennyadsl kennyadsl merged commit 7c202de into solidusio:master Mar 6, 2020
spaghetticode added a commit to solidusio/solidus_stripe that referenced this pull request Mar 10, 2020
Since solidusio/solidus#3524 was merged,
we need to verify if we're using the single "Name" field or the
previous first/last name combination.
spaghetticode added a commit to spaghetticode/solidus_stripe that referenced this pull request Mar 10, 2020
Since solidusio/solidus#3524 was merged,
we need to verify if we're using the single "Name" field or the
previous first/last name combination.
spaghetticode added a commit to spaghetticode/solidus_stripe that referenced this pull request Mar 10, 2020
Since solidusio/solidus#3524 was merged,
we need to verify if we're using the single "Name" field or the
previous first/last name combination.
stem added a commit to stem/solidus_product_assembly that referenced this pull request Apr 18, 2020
Because of addresses' firstname & lastname deprecations in solidusio/solidus#3584,
solidusio/solidus#3524 and probably other PRs, the inputs where deleted
in favor of a single `name` input.
This is only on master for now, so it should be in 2.11 or 3.0.
stem added a commit to stem/solidus_product_assembly that referenced this pull request Apr 18, 2020
Because of addresses' firstname & lastname deprecations in solidusio/solidus#3584,
solidusio/solidus#3524 and probably other PRs, the inputs where deleted
in favor of a single `name` input.
This is only on master for now, so it should be in 2.11 or 3.0.
stem added a commit to stem/solidus_product_assembly that referenced this pull request Apr 18, 2020
Because of addresses' firstname & lastname deprecations in solidusio/solidus#3584,
solidusio/solidus#3524 and probably other PRs, the inputs where deleted
in favor of a single `name` input.
This is only on master for now, so it should be in 2.11 or 3.0.
aldesantis pushed a commit to stem/solidus_product_assembly that referenced this pull request Apr 25, 2020
Because of addresses' firstname & lastname deprecations in solidusio/solidus#3584,
solidusio/solidus#3524 and probably other PRs, the inputs where deleted
in favor of a single `name` input.
This is only on master for now, so it should be in 2.11 or 3.0.
filippoliverani added a commit to filippoliverani/solidus_tax_cloud that referenced this pull request May 15, 2020
In solidusio/solidus#3524 we introduced a new preference that allows
to use the combined version of firstname/lastname.
This commit updates checkout feature specs to reflect this preference.
Once the split version will be deprecated and removed, we can
probably also revert this commit and use the combined version only.
aldesantis pushed a commit to filippoliverani/solidus_tax_cloud that referenced this pull request May 16, 2020
In solidusio/solidus#3524 we introduced a new preference that allows
to use the combined version of firstname/lastname.
This commit updates checkout feature specs to reflect this preference.
Once the split version will be deprecated and removed, we can
probably also revert this commit and use the combined version only.
filippoliverani added a commit to solidusio-contrib/solidus_handling_fees that referenced this pull request May 22, 2020
In solidusio/solidus#3524 we introduced a new preference that allows
to use the combined version of firstname/lastname.
This commit updates checkout feature specs to reflect this preference.
Once the split version will be deprecated and removed, we can
probably also revert this commit and use the combined version only.
@@ -103,6 +103,7 @@ class Application < ::Rails::Application
Spree.config do |config|
config.mails_from = "[email protected]"
config.raise_with_invalid_currency = false
config.use_combined_first_and_last_name_in_address = true
Copy link
Member

Choose a reason for hiding this comment

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

This should have been false, because we still tested v2.11 here, that has this set to false (see above)
That way specs are misleadingly green and issues like #4094 didn't came up in the specs for v2.11

I am proposing to revert this in v2.11 branch

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