Repository navigation
Comment AI features: keep gated post context and non-comment types out of AI requests - #1192
Conversation
…s out of AI requests - Suggest Reply only sends the parent post's title and excerpt when the post is publicly readable (new `wpai_suggest_reply_post_context_shareable` filter), matching Comment Moderation's existing policy. The shared check moves to `is_post_publicly_readable()`. - Comment Moderation only auto-analyzes regular comments, skipping pingbacks, trackbacks and block editor notes (new `wpai_comment_moderation_comment_types` filter). - Uninstall removes Comment Moderation's `_wpai_*` comment meta. - Remove duplicate Comment_Moderation and Key_Encryption entries from EXPERIMENT_CLASSES. Co-Authored-By: Jeffrey Paul <2818133+jeffpaul@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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:
|
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1192 +/- ##
=============================================
+ Coverage 85.34% 85.36% +0.01%
- Complexity 4431 4435 +4
=============================================
Files 173 173
Lines 16435 16457 +22
=============================================
+ Hits 14027 14049 +22
Misses 2408 2408
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:
|
|
|
||
| // Comment meta: the Comment Moderation analysis results and status. These | ||
| // are cached scores that carry no meaning without the plugin. | ||
| $comment_meta_keys = array( |
There was a problem hiding this comment.
Worth noting we decided to purposely not delete these when first working on this uninstall code. The idea being is that someone may have / want to build custom functionality that uses this information and it's a minor amount of data so no storage concerns there.
Doesn't mean we can't change our minds now but wanted to highlight the history here. Also likely other meta we decided to leave behind for the same reason.
Also requires a publicly viewable post type, and tightens the comment types filter docblock to list<string>, per review. Co-Authored-By: Jeffrey Paul <2818133+jeffpaul@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Jeffrey Paul <2818133+jeffpaul@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What?
Closes #1191
Fixes the four issues reported in #1191:
Why?
How?
is_post_publicly_readable( WP_Post )helper inincludes/helpers.php. It holds the same logic as Comment Moderation's existing check, which now calls it. Thewpai_comment_analysis_post_context_shareablefilter is unchanged.get_post_context()returns the post title and excerpt only when the post is publicly readable. A newwpai_suggest_reply_post_context_shareablefilter lets sites opt in, for example on intranet sites. For gated posts, the reply is generated from the comment alone.should_moderate_comment_type()method, with awpai_comment_moderation_comment_typesfilter (defaultarray( 'comment' )). An empty legacy type counts ascomment. Manual and bulk analysis from the Comments screen are unchanged.delete_meta()now deletes the five_wpai_*comment meta keys withdelete_metadata( 'comment', 0, $key, '', true ). The docblock is updated. Generated content (wpai_generated_summary,wpai_note,wpai_generated) is still kept.Comment_ModerationandKey_Encryptionlines.docs/experiments/suggest-reply.mdanddocs/experiments/comment-moderation.mddescribe the new behavior and filters.Not changed here:
moderate_commentscapability rather than per-commentedit_comment.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Finding and confirming the issues, implementation, tests and docs. Reviewed by me.
Testing Instructions
<post-title>or<post-context>, and a reply is still generated. Repeat on a public post: both tags are present.SELECT COUNT(*) FROM wp_commentmeta WHERE meta_key LIKE '\_wpai\_%'returns 0.Automated:
EXPERIMENT_CLASSEShas no duplicatesdevelopand passes with this change.develop.Changelog Entry
🤖 Generated with Claude Code
This response was drafted in consultation with AI and reviewed and approved by a human.