Repository navigation
Image Prompt Generation: Name image prompts in the post permission error - #1234
Conversation
|
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. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
POST /wp-json/wp-abilities/v1/abilities/ai/image-prompt-generation/runwith{"input":{"content":"A cat","context":"1"}}, where post 1 belongs to another user.insufficient_capabilitieswith "You do not have permission to generate image prompts for this post." Ondevelopit 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
developand then on this branch.Automated:
test_permission_callback_returns_error_for_post_user_cannot_editinImage_Prompt_GenerationTest.php. It fails ondevelop.npm run test:phpandnpm run test:php:multisitepass (2573 tests each).npm run lint:phpandnpm run lint:php:stanpass.Screenshots or screencast
develop)Changelog Entry