Skip to content

fix: address WordPress.org plugin review feedback - #359

Open
leogermani wants to merge 7 commits into
trunkfrom
fix/plugin-review-feedback
Open

leogermani wants to merge 7 commits into
trunkfrom
fix/plugin-review-feedback

Conversation

@leogermani

@leogermani leogermani commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

The WordPress.org plugin review sent back a list of issues that block Rolling Coverage from the plugin directory. This PR addresses each one so the plugin can be resubmitted.

What changes

The biggest change for publishers: reader analytics events are now off until a site opts in. The directory doesn't allow tracking without opt-in consent, so sites that used Site Kit's GA4 tag to measure which entries readers see will stop reporting those events after the update until an editor turns the new setting on.

With this change:

  • Settings > General has a Reader Analytics toggle, off by default. Users who can write posts are still never counted.
  • The readme lists every outside service the plugin can talk to (Slack, Google Analytics through Site Kit, the AI provider, OneSignal), with what is sent, when, and links to each service's terms and privacy policy.
  • The Slack Monitor keeps its log in the database instead of a file in uploads. The old log file is deleted.
  • Share links redirect readers with a properly enqueued script.
  • Stored block templates use a prefixed option name. Pages cached before the update keep working.
  • Layout words are translatable by the directory's translation tools.
  • The readme's contributor is the plugin's directory owner.

How to test

  1. On a site with Site Kit's GA4 tag, view a liveblog page signed out. window.newspackRollingCoverageFrontend.readerAnalyticsEnabled is "".
  2. As an editor, go to Rolling Coverage > Settings > General. The Reader Analytics section shows the toggle off.
  3. Turn it on and select Save. "Settings saved." appears, and the toggle stays on after a reload.
  4. View the liveblog page signed out again. readerAnalyticsEnabled is "1", and scrolling entries into view pushes coverage_entry_seen to dataLayer.
  5. View it signed in as an author. readerAnalyticsEnabled is "".
  6. With Slack connected, open Rolling Coverage > Settings > Slack > Monitor. "Monitor started." appears first.
  7. Post a message in a linked channel. Its webhook events appear in the Monitor within a few seconds.
  8. Check wp-content/uploads/newspack-rolling-coverage/. No .php log file is created.
  9. Share an entry and open the shared link in a new window. It redirects to the page it was shared from, opened at that entry.
  10. Build the zip with npm run release:archive, set Stable tag to the version, and run Plugin Check. It reports no errors or warnings.
Technical details

Review items and fixes

  • Enqueue JS: Social_Sharing::enqueue_redirect_script() runs on wp_enqueue_scripts and registers a src-less handle with wp_add_inline_script(), printed in the head.
  • Prefixes: TEMPLATE_OPTION_PREFIX is now newspack_rolling_coverage_tpl_. load_block_config() falls back to the rc_tpl_ key and moves it, because pages in the page cache keep polling with their old key. Pruning and coverage deletion clear both prefixes.
  • Phoning home: new Reader_Analytics class, option newspack_rolling_coverage_reader_analytics (absent means off), route /settings/reader-analytics with the same capability as the other General settings. localize_frontend_config() sets readerAnalyticsEnabled only when the option is on, and that flag gates both the dataLayer push and the GA4 call. The flag is renamed from readerTrackingEnabled, so pages cached before the update, which still carry the old flag, send nothing. Turning the setting off reaches cached pages when the page cache refreshes, like every other setting.
  • External services: new == External services == section in readme.txt.
  • Writing to disallowed locations: Slack_Monitor stores up to 500 entries, each with a sequence number, in the non-autoloaded option newspack_rolling_coverage_slack_monitor_log. The poll's offset is now the last sequence number seen rather than a byte offset; the client already treats it as opaque. Two webhooks logging at the same moment can overwrite each other's entry. That's accepted for a live troubleshooting view and noted in the class doc. The keep-alive works as before. The first poll after the update deletes the legacy random-named .php file and its rolling_coverage_slack_monitor_filename option.
  • REST permission_callback: the reported gap was already closed: restoring into a recovery liveblog needed manage_categories. The check now reads the taxonomy's edit_terms cap, and a test covers an author restoring their own published entry (403, no term created).
  • load_plugin_textdomain: removed.
  • i18n: Layout_Templates::strings() lists each layout word as a literal __() call. test_every_layout_word_is_translatable fails when a layout uses a word missing from it. _x( '55', 'excerpt_length' ) is now 55.
  • Contributors: leogermani, the plugin's directory owner. The review flagged automattic as unrelated to this plugin.

Two Plugin Check warnings from code added after 0.3.0 are fixed as well: an unprefixed loop variable in the Every live story pattern, and core hook names in Summary::update_term_count().

Verification: PHPUnit 1636 passed, Jest 246 passed, and PHPCS, ESLint and typecheck are clean. Each new test was confirmed red with its fix reverted. Plugin Check 2.2.0 on the built zip reports only trunk_stable_tag, which goes away when the release zip's Stable tag is set by hand.

Not included: the docs site screenshot guides/settings-1.webp predates the Reader Analytics section. The new section sits below the fold, so the image may not need a retake.

Self-review: not run.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unconditional legacy-option deletion can lose templates when migration writes fail, and cached HTML can keep reader tracking active without current opt-in.

2 open issues
What changed in this PR

This PR prepares Rolling Coverage for WordPress.org resubmission by addressing reader analytics consent, external-service disclosures, and plugin-directory requirements.

Changes:

  • Adds an off-by-default Reader Analytics setting with REST support and documentation.
  • Moves Slack Monitor logs into the database and migrates stored template options to a prefixed name.
  • Updates script enqueueing, translation handling, permission checks, and regression tests.
File Description
tests/​test-social-sharing.php Tests the enqueued redirect script.
tests/​test-slack-monitor.php Covers database logging and legacy-file cleanup.
tests/​test-reader-analytics.php Tests analytics opt-in and permissions.
tests/​test-layout.php Tests legacy template-option migration.
tests/​test-layout-templates.php Checks translation coverage for layout strings.
tests/​test-entry-restore.php Extends recovery permission tests to authors.
src/​blocks/​rolling-coverage/​DEVELOPMENT.md Documents the template option prefix.
src/​admin/​utils/​slack-api.ts Updates comments describing monitor offsets.
src/​admin/​utils/​reader-analytics-api.ts Adds analytics settings API helpers.
src/​admin/​types/​index.ts Adds analytics settings types and endpoint configuration.
src/​admin/​DEVELOPMENT.md Documents the fifth General settings section.
src/​admin/​components/​general-settings.tsx Adds the Reader Analytics toggle and save flow.
site/​content/​docs/​guides/​settings.mdx Explains reader analytics for publishers.
site/​content/​docs/​developers/​rest-api.mdx Lists the analytics settings endpoint.
site/​content/​docs/​developers/​data.mdx Updates analytics, template, and monitor storage references.
readme.txt Discloses external services and updates the contributor.
newspack-rolling-coverage.php Removes explicit text-domain loading.
includes/​slack/​class-slack-monitor.php Replaces file logging with bounded database storage.
includes/​patterns/​every-live-story.php Prefixes the pattern loop variable.
includes/​class-summary.php Adds lint exceptions for existing core hooks.
includes/​class-social-sharing.php Enqueues the inline share redirect script.
includes/​class-reader-analytics.php Implements the analytics option and REST handlers.
includes/​class-post-type.php Uses the taxonomy capability for recovery creation.
includes/​class-initializer.php Initializes reader analytics support.
includes/​class-admin.php Exposes the analytics endpoint to the admin interface.
includes/​blocks/​class-rolling-coverage-block.php Gates analytics and migrates template option keys.
includes/​blocks/​class-layout-templates.php Makes layout strings discoverable by translation tools.
includes/​blocks/​class-entry-bindings.php Uses a numeric default excerpt length.
includes/​blocks/​class-breakout-card.php Uses a numeric default teaser length.
.github/​CONTRIBUTING.md Updates feature, endpoint, and storage references.

Review effort: Balanced

// never for the site's own staff.
$can_edit_posts = current_user_can( 'edit_posts' );
$should_track_reader_events = ! $can_edit_posts;
$should_track_reader_events = ! $can_edit_posts && Reader_Analytics::is_enabled();
leogermani and others added 3 commits December 1, 2026 14:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leogermani
leogermani marked this pull request as ready for review December 1, 2026 17:38
leogermani and others added 3 commits December 2, 2026 13:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants