Extract Alerts admin UI and trigger engine into collaborators. - #1995
Open
shadyvb wants to merge 2 commits into
Open
Extract Alerts admin UI and trigger engine into collaborators.#1995shadyvb wants to merge 2 commits into
shadyvb wants to merge 2 commits into
Conversation
…s, AJAX, and record matching can be unit-tested without booting WordPress.
shadyvb
marked this pull request as ready for review
September 6, 2026 20:27
Move WP_Query and WP_Roles stubs into dedicated files, add phpcs:ignore for intentional $GLOBALS overrides in menu tests, and fix foreach closing comment formatting so lint-tests passes in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes XWPENG-52.
Extracts two collaborators from the monolithic
Alertsclass so admin UI concerns and record-matching logic can be unit-tested without booting WordPress.Alertsremains the registry for alert types, triggers, and post-type registration; it wiresAlerts_Admin_UIandAlerts_Trigger_Engineas public properties so in-plugin callers can reach them directly.Alerts_Admin_UIowns the Alerts admin experience: submenu registration, network-admin menu URL rewriting, script enqueue on the alerts list screen, meta-box/AJAX form rendering (display_*_box,load_alerts_settings,save_new_alert,get_actions,get_new_alert_triggers_notifications), and alert-specific action links.Alerts_Trigger_Engineowns record matching: hookswp_stream_record_inserted, hydrates enabled alerts, and exposesmatching_alerts()so filtering logic (including thewp_stream_alert_trigger_checkfilter viaAlert::check_record()) is testable in isolation beforesend_alert()runs.Alerts_Listquick-edit now delegates display callbacks to$plugin->alerts->admin_ui. Integration tests inAlerts_Testwere updated to call the collaborators; new Brain Monkey unit suites cover notification-value mapping, form output, menu URL rewriting, script enqueue guards,matching_alerts()filtering, andcheck_records()hydration/send behavior.Checklist
contributing.md).Release Changelog
N/A — internal refactor with no user-facing behavior change.
Release Checklist
masterbranch.readme.txt.stream.php.Stable taginreadme.txt.classes/class-plugin.php.