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 behavior when cloning region with page based offers #2667

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

charludo
Copy link
Contributor

Short description

Currently, cloning a region which has embedded offfers into pages can lead to unexpected errors when the newly-created region does not have the same offers enabled.

Proposed changes

  • allow users to choose from two behaviors when cloning a region: either force-activate all required offers* or discard embeddings for missing offers when cloning pages.
  • * small caveat: if no Zammad URL is provided for the new region, Zammad embeddings are discarded even when force-activation is selected

Side effects

  • none that I could find. As far as I can tell, results are correct in all cases (no cloning, cloning with force-activation or discarding, with/without Zammad URL)

Resolved issues

Fixes: #2665


Pull Request Review Guidelines

@charludo charludo requested a review from a team as a code owner February 21, 2024 16:32
@charludo charludo linked an issue Feb 21, 2024 that may be closed by this pull request
@charludo
Copy link
Contributor Author

One test i failing becuase the valid link count is somehow higher now after duplicating a region - I don't really know why, does someone have an idea?

@david-venhoff
Copy link
Member

One test i failing becuase the valid link count is somehow higher now after duplicating a region - I don't really know why, does someone have an idea?

With this pr the following link is classified as valid: https://integreat.app/cloned/de/offers, while it is classified as invalid on develop.
We have some logic that checks internal links without doing network requests to those and in this case it verifies that the region cloned exists and has offers

if not region.offers.exists():

I assume that is now the case with this pr, while it had no offers before, which causes it to mark the link as valid...

So the simple fix to just update the expected numbers should be fine I think.

Copy link

codeclimate bot commented Mar 1, 2024

Code Climate has analyzed commit 12c48c6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 88.8% (50% is the threshold).

This pull request will bring the total coverage in the repository to 81.7% (0.0% change).

View more on Code Climate.

Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

integreat_cms/cms/forms/regions/region_form.py Outdated Show resolved Hide resolved
Copy link
Member

@MizukiTemma MizukiTemma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍 works as expected!

Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@charludo charludo merged commit 1be0f30 into develop Apr 2, 2024
6 checks passed
@charludo charludo deleted the fix/cloning-pbo-error branch April 2, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloning Region with page based offers
3 participants