Skip to content

Image Prompt Generation: Name image prompts in the post permission error - #1234

Merged
dkotter merged 1 commit into
WordPress:developfrom
maheshbohara:fix/image-prompt-permission-message
Oct 28, 2026
Merged

dkotter merged 1 commit into
WordPress:developfrom
maheshbohara:fix/image-prompt-permission-message

Conversation

@maheshbohara

@maheshbohara maheshbohara commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #1233

Fixes the permission error of Image Prompt Generation for a post the user cannot edit, which said "generate excerpts" instead of "generate image prompts".

Why?

The message in Generate_Image_Prompt::permission_callback() was copied from Excerpt Generation. The same method already says "You do not have permission to generate image prompts." when no post is given, so only the per-post message was wrong. Steps are in #1233.

How?

The per-post message now reads "You do not have permission to generate image prompts for this post." The error code is unchanged.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus
Used for: Investigation, implementation, tests, manual testing, and PR wording. I reviewed the changes and the test results, and I take responsibility for the contribution.

Testing Instructions

  1. Enable the Image Generation feature under Settings > AI.
  2. Log in as a Contributor.
  3. Send POST /wp-json/wp-abilities/v1/abilities/ai/image-prompt-generation/run with {"input":{"content":"A cat","context":"1"}}, where post 1 belongs to another user.
  4. The response is 403 insufficient_capabilities with "You do not have permission to generate image prompts for this post." On develop it says "generate excerpts".

I sent this request from a Contributor's session in Chrome on WordPress 7.1.3 (wp-env, PHP 8.3), first on develop and then on this branch.

Automated:

  • New PHPUnit test test_permission_callback_returns_error_for_post_user_cannot_edit in Image_Prompt_GenerationTest.php. It fails on develop.
  • npm run test:php and npm run test:php:multisite pass (2573 tests each). npm run lint:php and npm run lint:php:stan pass.
  • No JS changed.

Screenshots or screencast

Before (develop) After (this branch)
37-develop-message 37-branch-message

Changelog Entry

Fixed - Image Prompt Generation: the permission error for a post now mentions image prompts instead of excerpts.

Open WordPress Playground Preview

@maheshbohara
maheshbohara requested a review from a team October 28, 2026 13:25
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: maheshbohara <maheshbohara@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.32%. Comparing base (a778c74) to head (e5e1707).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1234      +/-   ##
=============================================
+ Coverage      85.28%   85.32%   +0.03%     
  Complexity      4417     4417              
=============================================
  Files            173      173              
  Lines          16391    16391              
=============================================
+ Hits           13979    13985       +6     
+ Misses          2412     2406       -6     
Flag Coverage Δ
unit 85.32% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter dkotter added this to the 1.5.0 milestone Oct 28, 2026
@dkotter
dkotter merged commit a1ae6bd into WordPress:develop Oct 28, 2026
36 of 37 checks passed
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.

Image Prompt Generation: Permission error for a post says "generate excerpts"

2 participants