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: ensure campaign cover block does not render unless an image is selected #7732

Merged
merged 7 commits into from
Feb 20, 2025
2 changes: 1 addition & 1 deletion src/Campaigns/Blocks/CampaignCover/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function Edit({attributes, setAttributes, toggleSelection}: EditP
/>

)}

{hasResolved && campaign?.image &&
(!isSizeAligned ? (
<ResizableBox
Expand Down
4 changes: 2 additions & 2 deletions src/Campaigns/Blocks/CampaignCover/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use Give\Campaigns\Models\Campaign;
use Give\Campaigns\Repositories\CampaignRepository;

if ( ! isset($attributes['campaignId'])) {
if (!isset($attributes['campaignId'])) {
return;
}

/** @var Campaign $campaign */
$campaign = give(CampaignRepository::class)->getById($attributes['campaignId']);

if ( ! $campaign) {
if (!$campaign || !$campaign->image) {
return;
}

Expand Down
Loading