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

Refactor: migrate v2 forms to campaigns and add upgraded forms as campaign not-default forms #7645

Open
wants to merge 12 commits into
base: epic/campaigns
Choose a base branch
from

Conversation

glaubersilva
Copy link
Contributor

@glaubersilva glaubersilva commented Dec 11, 2024

Resolves GIVE-2032

Description

This PR makes the migrations of Forms to Campaigns also consider V2 forms. It also fixed a problem that was preventing forms with the upgraded status from being associated with campaigns as not-default forms in certain scenarios.

Affects

The migrations of Forms to Campaigns.

Visuals

https://www.loom.com/share/7bf0d4727f944c0da29fd0df9219d7bc?sid=2b9f341f-c61a-4f13-b088-b8600b09afab

Testing Instructions

  1. In a fresh install create a few V2 and V3 forms;
  2. Migrate some V2 forms to V3 forms;
  3. Install the Give version of this branch;
  4. The migration should convert V2 forms to Campaigns;
  5. The migration should associate V2 upgraded forms to Campaigns as not-default forms.

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@glaubersilva glaubersilva self-assigned this Dec 11, 2024
@glaubersilva glaubersilva changed the title refactor: change query and implement getV2FormSettings initial version Refactor: migrate v2 forms to campaigns and add upgraded forms as campaign not-default forms Dec 11, 2024
@glaubersilva glaubersilva marked this pull request as ready for review December 12, 2024 16:00
/**
* Excluded upgraded V2 forms as their corresponding V3 version will be used to create the campaign - later the V2 form will be added to the proper campaign as a non-default form through the addUpgradedV2FormToCampaign() method.
*/
$upgradedFormsIds = $this->getUpgradedV2FormsIds();
Copy link
Member

Choose a reason for hiding this comment

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

Could this be refactored to a join of the meta with a "where not"? Or do we need a second query?

*
* @see https://wordpress.org/documentation/article/post-status/#auto-draft
*/
$query->where('forms.post_status', 'auto-draft', '!=');
Copy link
Member

Choose a reason for hiding this comment

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

I think this is conflating two different things. We do need to exclude auto-draft as a status, but I don't think that relates in any way to a form being "upgraded" (as stated in the comment above).

@@ -19,6 +20,8 @@ final class MigrateFormsToCampaignFormsTest extends TestCase

/**
* @unreleased
*
* @throws Exception
*/
public function testCreatesParentCampaignForDonationForm()
Copy link
Member

Choose a reason for hiding this comment

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

@glaubersilva can you add a new test to cover V2 forms that are not upgraded?

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.

2 participants