From d825bc2063e6a310a4cc4d3887c7641144bcd20c Mon Sep 17 00:00:00 2001 From: rpnykanen Date: Fri, 8 Sep 2023 08:52:59 +0300 Subject: [PATCH] UHF-8945: added comment, unecesary use of variable --- helfi_api_base.module | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/helfi_api_base.module b/helfi_api_base.module index 875c494c..99be4a93 100644 --- a/helfi_api_base.module +++ b/helfi_api_base.module @@ -55,9 +55,11 @@ function helfi_api_base_theme_suggestions_debug_item(array $variables) : array { * Implements hook_mail_alter(). */ function helfi_api_base_mail_alter(&$message) : void { - $environmentResolver = \Drupal::service('helfi_api_base.environment_resolver'); + // Prevent sending an email if current site/environment is unknown to the resolver. + // Only helfi-drupal sites are affected by this change. try { - $environmentResolver->getActiveEnvironment(); + \Drupal::service('helfi_api_base.environment_resolver') + ->getActiveEnvironment(); $message['send'] = FALSE; } catch (\InvalidArgumentException) {