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

Remove deprecated name-related Address fields #3820

Conversation

filippoliverani
Copy link
Contributor

@filippoliverani filippoliverani commented Oct 30, 2020

Description

Ref #3816 and #3234

This PR removes deprecated public-accessible Address name fields and their aliases:

  • full_name
  • firstname
  • first_name
  • lastname
  • last_name.

Address name attribute is still interally persisted on the DB as two separate firstname and lastname columms, in a future PR we can move them to a new name column and provide a rake task to help migrate existing data.

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 force-pushed the filippoliverani/remove-legacy-address-fields branch from 968ff73 to 051edf7 Compare October 30, 2020 16:42
@filippoliverani filippoliverani marked this pull request as ready for review November 2, 2020 08:34
core/app/models/spree/address.rb Outdated Show resolved Hide resolved
core/app/models/spree/address.rb Outdated Show resolved Hide resolved
@filippoliverani filippoliverani force-pushed the filippoliverani/remove-legacy-address-fields branch 2 times, most recently from 8668f44 to 1ba0224 Compare November 6, 2020 10:59
@filippoliverani filippoliverani force-pushed the filippoliverani/remove-legacy-address-fields branch from 1ba0224 to df7004c Compare November 20, 2020 11:09
Copy link
Contributor

@DanielePalombo DanielePalombo left a comment

Choose a reason for hiding this comment

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

LGTM

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!

@kennyadsl kennyadsl requested a review from a team December 14, 2020 16:02
@kennyadsl kennyadsl added this to the 3.0.0 milestone Dec 14, 2020
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

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

@filippoliverani can you please rebase with the recent changes in address.rb?
Otherwise, it looks good to me 👍

@peterberkenbosch
Copy link
Contributor

how about we keep the first & lastname and add has_person_name dependency? This way we can still use firstname etc for integrations that need that but also just have a name field.

@DanielePalombo DanielePalombo force-pushed the filippoliverani/remove-legacy-address-fields branch from df7004c to 2c7fac4 Compare December 18, 2020 09:39
@DanielePalombo
Copy link
Contributor

DanielePalombo commented Dec 18, 2020

@spaghetticode I have rebased this PR

@filippoliverani
Copy link
Contributor Author

@peterberkenbosch @kennyadsl @spaghetticode

how about we keep the first & lastname and add has_person_name dependency? This way we can still use firstname etc for integrations that need that but also just have a name field.

An important principle behind the whole refactoring is that a name in an address doesn't have to map to a person name, I'm not sure we should encourage users to think otherwise.
Internally we were already splitting a full name to make legacy address-name based integrations work, we can keep using the same technique.

Moreover, splitting a name in multiple components make sense only for some kind of names and for some locales, Basacamp's name_of_person works only for english names unfortunately.

I think that, in general, developers should add their opinionated or locale-dependent way of saving persons' names to their User models. Address names instead can be more flexible and future-proof if kept as generic as possible.

What do you think?

@kennyadsl
Copy link
Member

As already suggested by someone else (maybe @elia), I also think we should have a name field on the user, which should represent how the user wants to be called. This could be optional so that we have a migration path for stores that want to keep that information present.

Also, we are still on time to keep both code paths (firstname+lastname and fullname) in Solidus 3, by removing the deprecation and allowing people to choose what works best in their store while we work on providing a better alternative for having a valid person name stored instead of using the shipping address name.

@filippoliverani
Copy link
Contributor Author

Also, we are still on time to keep both code paths (firstname+lastname and fullname) in Solidus 3, by removing the deprecation and allowing people to choose what works best in their store while we work on providing a better alternative for having a valid person name stored instead of using the shipping address name.

If we want to keepfirstname+lastname in Address, we have to explicitly write and save them to two separate attributes, otherwise we won't know how they should be split in the first place. If this is what we want, we should disregard #3234 and revert the work done up to now.

@kennyadsl
Copy link
Member

No wait, I didn't mean to revert what we did up to now 😅 , I meant (and I'm not even sure it's possible) to keep allowing both paths based on the use_combined_first_and_last_name_in_address preference value, until we have a clear alternative for those who were using the first name for specific reasons, like marketing emails or stuff like that. Of course, if we have a solution in mind we can go ahead, merge this, and release Solidus 3.0, but it sounds to me like something that a lot of stores will need to solve on their own before upgrading to Solidus 3.0.

@peterberkenbosch
Copy link
Contributor

I'm late to the party around the naming, I don't really understand or see the need to make this generic tbh. What I see right now personally is that it is causing more problems then it's solving. I do like the idea of moving the person name (firstname, lastname, mabye even middlename) to the user. That seems to be semanticly more correct. However this will cause some issues on what to do when a user wants to ship to someone else. What do we put on the shipping information? We do need a name there. Just a generic name field on address does not make sense to me tbh. Again, I'm late to the party, I might have missed the initial discussion around that (reading up on that right now).

Either way, it's easy enough to manually override this or make a tiny extension that does what I need :) Just a bit confused about the need. Feel free to ignore the above, the PR itself looks good to me.

@peterberkenbosch
Copy link
Contributor

I don't really understand or see the need to make this generic tbh.

And now I do.. 👍 any specific needs should be implemented by users indeed.

@kennyadsl kennyadsl merged commit e0a0aa0 into solidusio:master Jan 19, 2021
@kennyadsl kennyadsl deleted the filippoliverani/remove-legacy-address-fields branch January 19, 2021 09:08
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