-
Notifications
You must be signed in to change notification settings - Fork 193
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: Default form #7616
Refactor: Default form #7616
Conversation
…IVE-1949 # Conflicts: # src/Campaigns/Actions/LoadCampaignDetailsAssets.php # src/Campaigns/Models/Campaign.php
$defaultForm = $this->forms() | ||
->where('campaign_forms.is_default', true) | ||
->get(); | ||
|
||
if (is_null($defaultForm)) { | ||
$defaultForm = $this->legacyForms() | ||
->where('campaign_forms.is_default', true) | ||
->get(); | ||
} | ||
|
||
return $defaultForm; | ||
return give(DonationFormsRepository::class)->getById($this->defaultFormId); |
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.
Now we're talkin! 🙌
This is exactly what I was hoping for. This cleaned things up so much. Always good to see a PR that results in less, faster code. 💪 |
There is a new test failure that we need to address:
See https://github.com/impress-org/givewp/actions/runs/11936509340/job/33270320353?pr=7616 |
Description
This PR refactors the logic of getting and setting the default form. The default form id is now property of a campaign. The existing
form_id
column is used as a default form id column - this way we don't have to refactor P2P. Also, Campaign'sforms
anddefaultForm
methods are refactored. Theforms
method now returns both V2 and V3 forms.Affects
Campaign migrations
Campaign model
Campaign repository
Pre-review Checklist
@unreleased
tags included in DocBlocks