Skip to content

Leverage WordPress 6.9+ Notes for Review Tasks - #734

Open
ilicfilip wants to merge 16 commits into
developfrom
filip/review-post-notes
Open

Leverage WordPress 6.9+ Notes for Review Tasks#734
ilicfilip wants to merge 16 commits into
developfrom
filip/review-post-notes

Conversation

@ilicfilip

@ilicfilip ilicfilip commented Dec 24, 2025

Copy link
Copy Markdown
Collaborator

This PR integrates with WordPress 6.9's new Notes feature to make "Review post X" tasks more actionable. Instead of just sending users to the edit page, we now create block-level notes that guide them through reviewing specific elements.

Implements: https://github.com/ProgressPlanner/progress-planner-pro/issues/192

Changes

  • Added "Review with Notes" action button on review tasks (WP 6.9+ only)
  • When clicked, automatically injects notes for:
    • Images: Each core/image block gets a note asking to verify relevance and display
    • Linked images: Special message noting both image and link should be checked
    • Paragraphs with links: One note per paragraph containing links, with link count
  • Notes are linked to blocks via metadata.noteId attribute
  • Task completion now checks if all PRPL notes are resolved (when notes exist)
  • Falls back to original "post modified" check when no notes present
  • Duplicate prevention: won't create notes if block already has a valid note

How It Works

  1. User clicks "Review with Notes" on a review task
  2. Opens editor with ?prpl_inject_notes=1 parameter
  3. Notes are created and linked to relevant blocks
  4. User sees notes in the Notes panel, can click to highlight blocks
  5. User resolves notes as they review each element
  6. When all notes resolved → task auto-completes

Testing

  1. Create a post with images and paragraphs containing links
  2. Backdate post_modified to >12 months ago
  3. View the review task and click "Review with Notes"
  4. Verify notes appear in the Notes panel
  5. Resolve all notes and verify task completion

@github-actions

github-actions Bot commented Dec 24, 2025

Copy link
Copy Markdown
Contributor

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions

github-actions Bot commented Dec 24, 2025

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 33.81% 📉
Base Coverage 32.27%
Difference 📈 1.54%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

📊 File-level Coverage Changes (2 files)

📈 Coverage Improved

Class Before After Change
Progress_Planner\Suggested_Tasks\Providers\Content_Review 0.00% 40.18% +40.18%
Progress_Planner\Admin\Enqueue 11.59% 21.89% +10.30%
ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

@github-actions

github-actions Bot commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
10 0 10

⚠️ Warnings (10)

📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
295 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
440 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
444 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
451 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

ilicfilip and others added 4 commits January 30, 2026 12:26
When a post is opened via the "Review with Notes" action, enqueue a
small editor script that opens the "All notes" sidebar once the editor
is ready, so the injected review notes are immediately visible. Only
enqueued when the post has open PRPL notes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tacoverdo

Copy link
Copy Markdown
Contributor

Pushed 3a5bbe3, which makes the injected notes visible right away: clicking "Review with Notes" now auto-opens the Notes sidebar in the editor.

What it does:

  • New assets/js/review-post-notes.js waits for the block editor to finish initializing (so the sidebar restored from user preferences doesn't win), then opens the "All notes" sidebar (edit-post/collab-history-sidebar) via enableComplementaryArea.
  • Content_Review::maybe_enqueue_notes_sidebar_script() (hooked to enqueue_block_editor_assets, inside the existing supports_notes() gate) enqueues it only when prpl_inject_notes=1 is present, the user can edit the post, and the post has at least one open [PRPL] note — so posts with nothing to flag, or with everything resolved, don't get an empty sidebar opened. Since load-post.php runs before asset enqueueing, freshly injected notes are already there when this check runs.
  • Added a PHPUnit test covering all three branches (no param / no open notes / open notes).

Why the explicit dispatch: core only auto-opens the floating notes sidebar when no other sidebar is active — most users have the Document panel open, which suppresses it. Targeting the pinned "All notes" sidebar also works in all rendering modes, unlike the floating one (post-only + large viewports).

Tested: full PHPUnit suite green against WP 7.1, 7.0.4, and 6.9.7 (416 tests); on 6.7.7 the notes tests correctly stay inert (1 expected skip). WP 6.5 predates the plugin's 6.6 minimum and fails at bootstrap for unrelated reasons (wp_autoload_values_to_autoload()).

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.

3 participants