Skip to content

Let plugins override a banner's schedule - #2

Merged
dpanta94 merged 2 commits into
mainfrom
feat/filterable-schedule
Oct 13, 2026
Merged

dpanta94 merged 2 commits into
mainfrom
feat/filterable-schedule

Conversation

@dpanta94

@dpanta94 dpanta94 commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Lets plugins override whether a banner is in its schedule, so QA can see a banner before it starts without moving the site's clock.

Ticket: none on this branch. Related: SMTNC-3096 (TEC, GiveWP and LearnDash start the Nexcess banner on 14 October, 12:00 EDT).

What changes

  • New filter nx_banners_scheduled:{id}. It receives whether the banner is inside its schedule (bool) and can force it either way:
    add_filter( 'nx_banners_scheduled:nexcess-software-packages', '__return_true' );
  • It is per banner ID, so faking one banner never moves another's schedule.
  • It applies only when the plugin that registered the banner bundles 1.1.0 or later.
  • Package::VERSION is now 1.1.0, so the stylesheet URL changes with the release. Nothing breaks.

Proof

  • composer check: 46 tests, phpcs and phpstan clean. New tests cover the filter showing a banner before its start, hiding one inside its schedule, and another banner's filter changing nothing. The first two failed before the change.
  • Not yet exercised in a plugin: the plugins pick it up once 1.1.0 is published.

AI usage: Drafted with Claude Opus 5.5. I reviewed and tested every change — this is my work and I am accountable for it.

Summary by CodeRabbit

  • New Features
    • Added a per-banner schedule filter that can override whether a banner is considered scheduled, including allowing it to appear before its start time or hiding it while it is within its schedule.
    • Updated the package version to 1.1.0.

`nx_banners_scheduled:{id}` filters whether a banner is inside its schedule, so QA can see a banner before it starts, or hide one inside it, without moving the site's clock. The filter is per banner ID, so faking one banner's schedule never moves another's. It only applies when the plugin that registered the banner bundles a copy of the package that has it.
The bundled stylesheet's URL carries the package version, so browsers fetch the new file after the update.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: c99dd6ba-de5b-4363-ac7d-eda4eee0cc76
📥 Commits

Reviewing files that changed from the base of the PR and between f99707f and ddb8e2b.

📒 Files selected for processing (4)
  • README.md
  • src/Banner.php
  • src/Package.php
  • tests/BannerTest.php

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

📝 Walkthrough

Banner::isScheduled() now passes the existing schedule result through a per-banner filter. The package version is now 1.1.0. Tests and README documentation cover the filter behavior and version requirement.

Changes: Per-banner schedule filter

Layer / File(s) Summary
Add and document schedule override
src/Banner.php, src/Package.php, tests/BannerTest.php, README.md
Banner::isScheduled() applies nx_banners_scheduled:<id> to its existing schedule result and returns the boolean-cast value. Tests cover allowing a banner before its start time, hiding a banner within its schedule, and ignoring a filter for another banner ID. The package version changes to 1.1.0. The README documents the filter and its version requirement.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to ddb8e

The per-banner schedule override is documented, and the supplied tests cover both override directions and banner-ID isolation. No specific merge-blocking risk is established.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: allowing plugins to override a banner's schedule.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@dpanta94
dpanta94 marked this pull request as ready for review October 13, 2026 14:29
@dpanta94 dpanta94 self-assigned this Oct 13, 2026
@dpanta94
dpanta94 merged commit 782dc57 into main Oct 13, 2026
8 checks passed
@dpanta94
dpanta94 deleted the feat/filterable-schedule branch October 13, 2026 14:32
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.

1 participant