-
Notifications
You must be signed in to change notification settings - Fork 6
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
Improve soft-deletion faculty #102
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let's use the `discard` gem for soft-deleting promotions.
mamhoff
force-pushed
the
discard-promotions
branch
from
January 25, 2024 10:38
5bc903c
to
602eb0b
Compare
There are still a few bugs with the new admin, so let's disable that for the time being.
We don't want to allow people to edit or re-create deleted promotions, so we just indicate they're there for now. Let's see if we find a need to show them in some kind of uneditable mode.
When a promotion has been applied to an order, we need to make sure no adjustments remain that have that promotion's actions as their source. For incomplete orders, we can simply delete the adjustments, but for complete orders, we must stop the promotion action from being deleted.
We now protect against destroying promotion actions that have been applied to a complete order, so we can stop the dependent: :nullify thing.
There's no need for soft-delete on promotion actions, now that we have soft-delete on promotions.
We don't need soft-delete on promotion actions when we have soft-delete on promotions.
mamhoff
force-pushed
the
discard-promotions
branch
from
January 25, 2024 10:46
602eb0b
to
61b6ec3
Compare
tvdeyen
approved these changes
Jan 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this PR, soft deletion was implemented for the
SolidusFriendlyPromotion::PromotionAction
. However, there was no UI making soft-deleted records visible, and it appears this was only done so thatSpree::Adjustment
records never lose their source.This PR moves the soft-deletion faculty to the
SolidusFriendlyPromotion::Promotion
model, adds a little bit of UI to make them visible if necessary, and tells theSpree::PromotionAction
model how to deal with adjustments: If there's adjustments where the order is complete, refuse to be deleted, if there's adjustments where the order is incomplete, delete those adjustments.Fixes #30