Skip to content

Conversation

@hnccox-yard
Copy link

@hnccox-yard hnccox-yard commented Jul 4, 2025

This PR makes sure that no emails from any staging environment are actually send out via WordPress, unless they are on the whitelist. This prevents accidental emails being send when using real data.

@hnccox-yard hnccox-yard requested review from a team, Rovasch, SimonvanWijhe, dtakken, ictbeheer, mvdhoek1, rivanuff and robertbossaert and removed request for a team July 4, 2025 19:29
@github-actions
Copy link

github-actions bot commented Jul 4, 2025

Coverage report for commit: 9759b65
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ███████████████████████ │ 90.7%
  10% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
  20% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
 100% │ █░░░░░░░░░░░░░░░░░░░░░░ │  2.3%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 2.49% | Methods: 3.33%
FilesLinesMethodsBranches
src/ACF
   ACFServiceProvider.php--100.00%
src/ACF/Controllers
   ProtectionTypeController.php--100.00%
   WhitelistGroupController.php--100.00%
src/BranchViewer
   BranchViewer.php85.00%50.00%100.00%
   BranchViewerServiceProvider.php16.67%-100.00%
src/Cleanup
   CleanupServiceProvider.php--100.00%
   EnqueuedScriptsStyles.php--100.00%
   MapMetaCap.php--100.00%
src/Cleanup/Plugins
   BaseAbstract.php--100.00%
   SearchWP.php--100.00%
   Stream.php--100.00%
src
   ConfigExpanderServiceProvider.php--100.00%
src/Disable
   DisableAdminNotices.php--100.00%
   DisableComments.php--100.00%
   DisableEmojicons.php--100.00%
   DisableFeed.php--100.00%
   DisableHeaders.php--100.00%
   DisableOEmbedEndpoint.php--100.00%
   DisablePosts.php--100.00%
   DisableRoles.php--100.00%
   DisableServiceProvider.php--100.00%
   DisableUsersEndpoint.php--100.00%
src/Licenses/Contracts
   AbstractLicense.php--100.00%
   LicenseInterface.php100.00%100.00%100.00%
src/Licenses
   LicenseManager.php--100.00%
   LicensesServiceProvider.php--100.00%
src/Licenses/Plugins
   AdvancedCustomFieldsLicense.php--100.00%
   FacetWPLicense.php--100.00%
   GravityFormsLicense.php--100.00%
   SearchWPLicense.php--100.00%
   SeoPressLicense.php--100.00%
   WpMigrateLicense.php--100.00%
src/LoginScreenCustomization
   LoginScreenCustomization.php--100.00%
   LoginScreenCustomizationServiceProvider.php--100.00%
src/Mail
   MailServiceProvider.php--100.00%
   MailWhitelistFilter.php--100.00%
src/Protection
   Protect.php11.32%14.29%100.00%
   ProtectionServiceProvider.php--100.00%
   WhitelistEntity.php--100.00%
src/Support/Helpers
   WordPressEnvironment.php--100.00%
src/Support/Traits
   PluginActive.php--100.00%
   Route.php--100.00%
src/routes
   web.php-100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

@hnccox-yard hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch 9 times, most recently from b4907b0 to 4c9f2bb Compare July 5, 2025 10:31
@mvdhoek1
Copy link
Contributor

mvdhoek1 commented Jul 5, 2025

Wat is hier de use case van en is dit relevant voor alle projecten?

@hnccox-yard hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch from 724d75c to 5e87d6f Compare July 5, 2025 12:49
Copy link

@dtakken dtakken left a comment

Choose a reason for hiding this comment

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

Vraag: Wil je errors enkel loggen (wat je niet meteen merkt) of een exception gooien (merk je wel meteen)?

@hnccox-yard hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch from e892690 to e917d12 Compare July 7, 2025 13:44
Copy link
Contributor

@mvdhoek1 mvdhoek1 left a comment

Choose a reason for hiding this comment

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

Gelieve de boel eerst opschonen, zoals de eerdere review comments ook al aangeven.

@hnccox-yard hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch 3 times, most recently from 1151093 to 5fd63ea Compare November 4, 2025 09:35
@hnccox-yard
Copy link
Author

Vraag: Wil je errors enkel loggen (wat je niet meteen merkt) of een exception gooien (merk je wel meteen)?

Ik denk dat loggen voldoende is, dit is niet iets wat in Sentry hoeft te komen denk ik.

@hnccox-yard hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch 10 times, most recently from 2346917 to abf6ec8 Compare November 4, 2025 12:25
@hnccox-yard hnccox-yard force-pushed the feat/catch-emails-in-staging-env branch from abf6ec8 to ad8b13f Compare November 4, 2025 12:27
/**
* Filter wp_mail to restrict email sending in staging environment.
*/
add_filter('wp_mail', [MailHandler::class, 'filter']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Worden de IDE's ook blij van: add_filter('wp_mail', MailHandler::filter(...));

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.

7 participants