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

[FIX] A few small tweaks for the new promotion admin #5953

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

adammathys
Copy link
Member

Summary

Makes a couple of small tweaks to fix a few issues with the new promotions admin:

  1. Adds the inverse_of option to the SolidusPromotions::Promotion#codes association.
    • This helps fix an issue preventing new promotions with a single code from being created. It would generate an undefined method on nil error because the new promotion code would not recognize that it was associated to an unpersisted promotion.
  2. Sets the model_class on the new Admin::PromotionCodesController.
    • Due to how our admin resource controllers are setup, we need to explicitly set the value because the default is to assume everything exists within the Spree namespace.

Checklist

adammathys and others added 2 commits November 27, 2024 15:06
This helps fix an issue when creating a new promotion with a single
code. Without the inverse_of parameter, our associated codes won't
correctly infer that they're associated to a new promotion and will
generate undefined method for nil errors.

Co-authored-by: Alistair Norman <[email protected]>
Unfortunately, our resource controller is hardcoded to look for a
`Spree::<model_name>` object, which obviously doesn't work with the new
promotion namespace.

Co-authored-by: Alistair Norman <[email protected]>
@adammathys adammathys requested a review from a team as a code owner November 27, 2024 23:23
@github-actions github-actions bot added the changelog:solidus_promotions Changes to the solidus_promotions gem label Nov 27, 2024
@tvdeyen tvdeyen merged commit fb99b20 into solidusio:main Dec 3, 2024
13 of 14 checks passed
@tvdeyen tvdeyen added the backport-v4.4 Backport this pull-request to v4.4 label Dec 3, 2024
@tvdeyen
Copy link
Member

tvdeyen commented Dec 6, 2024

Backport after #6016

@tvdeyen tvdeyen added backport-v4.4 Backport this pull-request to v4.4 and removed backport-v4.4 Backport this pull-request to v4.4 labels Dec 6, 2024
Copy link

github-actions bot commented Dec 6, 2024

💚 All backports created successfully

Status Branch Result
v4.4

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v4.4 Backport this pull-request to v4.4 changelog:solidus_promotions Changes to the solidus_promotions gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants