Campus Connect: log silent email-trigger no-ops; fix overclaiming notice text (issue #1714 point 4) - #1748
Open
peiraisotta wants to merge 1 commit into
Open
Conversation
… UI text When wcpt_cc_needs_orientation fires with no Automated Reminder post assigned to the wcor_cc_needs_orientation trigger, send_triggered_emails() loops over zero posts and returns without a trace. Every other failure mode in the mailer (invalid recipients, wp_mail failure) is already logged; this was the only silent one, and it cost real debugging time when the Needs Orientation email did not arrive (issue #1714 point 4). Log via \WordCamp\Logger\log() when a trigger fires with no assigned reminders, and when every assigned reminder is skipped or fails. Reword the admin notice and audit note so they no longer state an email 'has been triggered' when the code only guarantees the trigger fired. See #1714. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
I'm not fully sure I understand this PR, it seems to be logging stuff, but AFAIK, these logs aren't actually shown or accessed anywhere? |
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.
Summary
Follow-up to #1730/#1731. Testing the Needs Orientation transition on a real Campus Connect application showed the private note and admin banner appear, but no organizer email is sent.
Root cause — configuration, not code:
WCOR_Mailer::send_triggered_emails()only sends Automated Reminder posts (organizer-reminderCPT) whosewcor_which_triggermeta matches the fired trigger. No reminder post on Central is assigned towcor_cc_needs_orientation— the trigger key first reached production with #1730's merge, so none can exist yet. The code path itself is verified working:test_cc_needs_orientation_trigger_message_sentpasses precisely because the test fixture creates and assigns a reminder post — the step production is missing. The email content must be created in wp-admin (Automated Reminders → new reminder → trigger "Campus Connect application needs orientation"); that's the actual fix and needs no deploy.This PR fixes the two things that made the gap invisible and misleading:
Changes
wordcamp-organizer-reminders/wcor-mailer.phpsend_triggered_emails()was the only silent failure path in the mailer —mail()already logs invalid recipients andwp_mail()failures. Now logs via\WordCamp\Logger\log()when:Both events are rare and always worth explaining, so log volume is negligible. No behaviour change when emails send normally.
wcpt/wcpt-wordcamp/wordcamp-admin.phpThe admin notice and audit note claimed "the organizer notification email has been triggered" — stated as fact even when no email exists to send, which is exactly what misled testing. Reworded both to claim only what the code guarantees (the trigger fired), following the same merge-resolution precedent applied to the point 5 text (#1731 comment). The notice now also names the Automated Reminders trigger so a wrangler knows where to look when no email arrives.
Not in this PR (one-time admin action, no deploy needed)
Create the Automated Reminder on Central: Automated Reminders → Add New → title = subject, body = email content → "When to send": on a trigger → "Campus Connect application needs orientation" → recipients: "the organizing team" (resolves to the application's
E-mail Address/Email Addressmeta) → restrict event subtype to Campus Connect. Note every WCOR email is already hard-CC'd tosupport@wordcamp.orgbymail(), satisfying that requirement in #1714 automatically.Test plan
php -lclean on both files (verified)test-wcor-mailer.phpsuite passes unchanged (no behavioural change when reminders are assigned;test_cc_needs_orientation_trigger_message_sentandtest_repeatable_trigger_sends_multiple_timescover the send paths)See #1714 (point 4).
🤖 Generated with Claude Code