-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Update Gemfile for Spree 2.0 #2209
Update Gemfile for Spree 2.0 #2209
Conversation
|
||
# Our branch contains two changes | ||
# - Pass customer email and phone number to PayPal (merged to upstream master) | ||
# - Change type of password from string to password to hide it in the form | ||
gem 'spree_paypal_express', github: "openfoodfoundation/better_spree_paypal_express", branch: "spree-upgrade-intermediate" | ||
#gem 'spree_paypal_express', github: "spree-contrib/better_spree_paypal_express", branch: "1-3-stable" | ||
# gem 'spree_paypal_express' |
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.
I'd remove this line. If it's commented out it's because we don't need it. If we ever do, Git will have in its history.
app/controllers/base_controller.rb
Outdated
@@ -37,7 +37,7 @@ def set_order_cycles | |||
|
|||
# And default to the only order cycle if there's only the one | |||
if @order_cycles.count == 1 | |||
current_order(true).set_order_cycle! @order_cycles.first | |||
current_order( create_order_if_necessary: true ).set_order_cycle! @order_cycles.first |
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.
no need for this extra spacing inside the parenthesis.
@@ -18,7 +18,7 @@ | |||
|
|||
# Patching to redirect to shop if order is empty | |||
def edit | |||
@order = current_order(true) | |||
@order = current_order( create_order_if_necessary: true ) |
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.
here as well
@@ -78,7 +78,7 @@ def populate | |||
# callbacks on Spree::Adjustment and then manually invoke Spree::Order#update! on success. | |||
|
|||
Spree::Adjustment.without_callbacks do | |||
populator = Spree::OrderPopulator.new(current_order(true), current_currency) | |||
populator = Spree::OrderPopulator.new(current_order( create_order_if_necessary: true ), current_currency) |
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.
here too
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.
Although we don't know how big the fixes introduced between 2.0.4 and 2.0.13 are, jumping from roughly 1.3.99 to 2.0.13 seems too big of a change to do in one go. Unless more issues like this one come up that force us to upgrade to a newer version I believe it's best to be conservative. You'll find an in-depth explanation in https://github.com/openfoodfoundation/openfoodnetwork/wiki/Spree-2.0-upgrade#getting-to-version-204- A previous effort was done to upgrade to v2.0.13 in openfoodfoundation#2209
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.
Sorry, I'm late to the party, just getting familiar with the Spree upgrade process. In order to avoid merge conflicts later on, I would like to suggest to split changes like this into two parts. Part one is pure re-factoring that can be applied to the stable master branch (not spree upgrade). The purpose is to contain Spree dependency in a small confined area. Part two is a contribution for the Spree upgrade where we can change only a few lines. This pull request is a great example. We see a lot of changes like:
- @order = current_order(true)
+ @order = current_order(create_order_if_necessary: true)
Instead of this change, I would create our own wrapper. In this case we can create two methods on the application controller:
current_order_or_new
current_order_if_exists
In part one, these two methods just call current_order(true)
or current_order(false)
. A lot of controllers are touched for this part, but we can easily merge it into master and improve it's readability already.
In part two, we can adapt to the Spree upgrade by touching only the two methods in the application controller without touching all the other ones.
What do you think guys? Should we do it?
@mkllnk yes, during the Spree upgrade (but not only) we constantly struggle to find the less disruptive strategy and the "wrapper" thing is something we're taking in account all the time. The idea is to take advantage of the Spree upgrade to define our own OFN business logic abstraction and then internally we can plug into Spree or make our own thing. In any case, yes. This PR could have included that OFN abstraction but in this specific case we didn't find a better reason than possible merge conflicts. But we'll need to question ourselves in any PR and ask other devs how to achieve it. |
@sauloperez I meant that we are changing a lot of calls to Spree's |
separate our code - YEAH!!!
… On 23 Apr 2018, at 11:14 AM, Maikel ***@***.***> wrote:
@sauloperez <https://github.com/sauloperez> I meant that we are changing a lot of calls to Spree's current_order here. My idea was to create our own version of current_order and name it slightly differently. Then we call our own method everywhere. We can do this change in the master branch to separate our code from Spree's code a bit more. In the Spree upgrade, we just need to change our implementation of our current_order method in one place without changing all the other files. That would prevent merge conflicts. With this way of encapsulation it's easier to deal with API changes in Spree.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#2209 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ACxryLwv3n9yLYU0yuCX6rPjbyi3nr7Pks5trSrsgaJpZM4TRwzU>.
|
that's an interesting idea @mkllnk. That's essentially implementing an adapter. I haven't considered the nice side effect of cutting down the possibility of merge conflict and that's a major win! This might not be the place to have an in-depth discussion about OOP design but I've been considering the possibility of building our own I feel like we need a series of design/architecture session to better address the spree upgrade. |
@sauloperez I say set up a call and invite all the people (aka @oeoeaio @mkllnk alongside of you guys working on Spree already). I think it's super important, and worth running potentially fortnightly catchups with our timezone to talk through things. IMO 😀 |
totally agree @daniellemoorhead . I want to prepare first a code proposal to base our discussions on. |
We finally had that call. Read about it in the Team catch ups wiki page. |
What? Why?
Closes #2219. First attempt to boot the app with Spree 2.0.