-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Ensure cartons find soft deleted shipping methods #3165
Conversation
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.
Thanks for making this PR @pelargir! 🚀
I think this would work, but I'd like to see if anyone else objects.
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.
Makes total sense to me. Thanks, Matt :)
I'm not sure we should do this. Every carton will now also return discarded records as well by default but I still can't figure out how to make this kind of things work with discard. |
@kennyadsl that was my concern, but I'm not sure if that is bad or acceptable. |
Currently shipping methods have both paranoia and discard on them (both using the I think a better solution might to be remove paranoia from the model, making the extra scope unnecessary. I'm not 100% on what else this might affect, though. |
@jarednorman That is the problem. I'm going to recommend not merging this until we can talk about it at a core team meeting.
Oops @tvdeyen I dismissed your review. 🤦♂️ I shouldn't look at PRs before having coffee. ☕️ |
I'm going to recommend not merging this until we can talk about it at a core team meeting.
Rebased from master to resolve conflict. |
Ideally it would only show the soft deleted |
Yes, but my concern is if we are using (in core, extensions or users' stores) some code to check if there's a shipping method attached to the carton. if carton.shipping_method
# do something dangerous
end The current behavior is returning In terms of functionality, do we really want to still build tracking urls for deleted shipping methods? Maybe not generating the tracking at all is the best thing as default behavior here, so probably a check of the shipping method presence in the |
@kennyadsl I see your point. If a carton's shipping method was soft deleted, wouldn't you still want to display it as part of the historical record for that carton? If it's important to indicate when a carton's shipping method has been deleted, the shipping method itself could be checked for its deletion status and an appropriate message displayed. I'm having trouble imagining a scenario where a dangerous operation would be performed based on the presence or absence of a carton's shipping method. |
@pelargir I'm sure it's the right thing to do and I'm also having trouble imagining a scenario when this could cause issues, maybe just some recurring task that makes sure that all cartons have a shipping method associated for consistency but... 🤷♂️ Let me talk with the rest of the core team during the next meeting about this and I'll let you know. I left a comment in the meantime, we should use discard scopes rather than paranoia ones. |
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.
Can you also take a look at why specs are not running, I think it's something with your CircleCI account. Let me know if I can be of help here.
@kennyadsl I've been attempting to fix the CircleCI build but I keep encountering the error in #3374. |
Even if a shipping method is soft deleted, cartons should still be able to find it. If they can't, the #tracking_url method blows up when it tries to call #build_tracking_url on a nil shipping method.
@kennyadsl the build is passing now. What else can I do to help get this approved? |
Also, not strictly related to the issue with |
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.
Thanks, @pelargir!
@solidusio/core-team can we have a second review here? |
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.
Nice. Thanks, Matt 👍
Thanks, @pelargir! |
Description
Ensure cartons can find soft deleted shipping methods they belong to. If they can't, the
#tracking_url
method blows up when it tries to call#build_tracking_url
on a nil shipping method.Checklist: