Skip to content

Commit

Permalink
Cover: Explicitly set isUserOverlayColor to false when media is updat…
Browse files Browse the repository at this point in the history
…ed (#65105)

Co-authored-by: andrewserong <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: huubl <[email protected]>
Co-authored-by: richtabor <[email protected]>
Co-authored-by: ajlende <[email protected]>
  • Loading branch information
7 people authored Sep 6, 2024
1 parent 9523fb4 commit 1a8aa20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/cover/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ const v12 = {
supports: v12BlockSupports,
isEligible( attributes ) {
return (
attributes.customOverlayColor !== undefined ||
attributes.overlayColor !== undefined
( attributes.customOverlayColor !== undefined ||
attributes.overlayColor !== undefined ) &&
attributes.isUserOverlayColor === undefined
);
},
migrate( attributes ) {
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/cover/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ function CoverEdit( {
averageBackgroundColor
);
__unstableMarkNextChangeAsNotPersistent();
setAttributes( { isDark: newIsDark } );
setAttributes( {
isDark: newIsDark,
isUserOverlayColor: isUserOverlayColor || false,
} );
} )();
// Disable reason: Update the block only when the featured image changes.
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -201,6 +204,7 @@ function CoverEdit( {
useFeaturedImage: undefined,
dimRatio: newDimRatio,
isDark: newIsDark,
isUserOverlayColor: isUserOverlayColor || false,
} );
};

Expand Down

1 comment on commit 1a8aa20

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 1a8aa20.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10733771163
📝 Reported issues:

Please sign in to comment.