Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upInvestigate removal of associate_user in OrdersController#edit #3559
Comments
|
Hello! I have read this discussion and as far as I could understand, The idea here is that instead of removing @bitberryru mentioned that every attribute that is set via Also at the checkout controller it is mentioned that the order of execution is different and therefore it could break something for some store. I'd like to know more about how different stores could have different behaviors in this specific point. Maybe I'm just not acquainted enough with this system or how it is used in production but this point left me somewhat confused. |
|
My mail server continues to flag github mails as spam :( I have not seen the discussions, I would have answered earlier. I’ll try to explain again, in the old versions building order and user association with it was in different places, now when you build/create an order (by calling current_order) it is immediately associated with the current user, now there is no need to separately associate the user with the order. This call (https://github.com/solidusio/solidus/blob/master/frontend/app/controllers/spree/orders_controller.rb#L44) has survived from the old days and has no sense now. FYI: There is only one case when it is required to associate an anonymous order with a user - after user authentication. This task is solved by solidus_auth_devise in warden hook. And this is the responsibility of the authentication system. |
|
Thanks, I understand now. |
|
@carlosep I agree with @bitberryru about being time to get rid of that method. About testing it I would suggest going through a deprecation cycle (which I will make it into 2.11) using a configuration flag to get the old behavior. In this scenario any store having an OrderController decorator that defines a method like this: def associate_user
super
# Update the order to reset the adjustments on the order once a user has
# been associated with it.
@order.recalculate
endshould see a deprecation and be able to move its customization elsewhere before upgrading. If done properly that should also cover the CheckoutController before-action and we should be able to cleanup things in a short cycle. |
|
Hi @elia, This seems like a good solution. Would that mean just a |
|
Hey @carlosep, yeah, that would surely mean a deprecation in the method, but that should also be accompanied by a Solidus configuration that allows disabling the new behavior, you can find many examples of similar deprecations in the Solidus codebase, e.g. you can see here how This is done to let store-owners update their stores individually, one deprecation at a time. Feel free to reach to me in the Solidus slack channel if you need more examples or have questions. |
Apparently, we can stop calling this method, see here for a more in-depth discussion.