Skip to content

Commit

Permalink
make sure content and title are not just empty spaces to decide on tr…
Browse files Browse the repository at this point in the history
…iggering featured image generation
  • Loading branch information
CGastrell committed Jan 6, 2025
1 parent 64d3036 commit 394ee4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Jetpack AI: do not trigger featured image generation if title or content are just empty spaces
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default function FeaturedImage( {
const generateAgainText = __( 'Generate another image', 'jetpack' );
const generateText = __( 'Generate', 'jetpack' );

const hasContent = postContent || postTitle ? true : false;
const hasContent = postContent.trim?.() || postTitle.trim?.() ? true : false;
const hasPrompt = hasContent ? prompt.length >= 0 : prompt.length >= 3;
const disableInput = notEnoughRequests || currentPointer?.generating || requireUpgrade;
const disableAction = disableInput || ( ! hasContent && ! hasPrompt );
Expand Down

0 comments on commit 394ee4e

Please sign in to comment.