Skip to content
Snippets Groups Projects

improve update status email subject

Open quietone requested to merge issue/drupal-1818764:1818764-correct--improve into 11.x
5 unresolved threads

Closes #1818764

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
392 392 function update_mail($key, &$message, $params) {
393 393 $langcode = $message['langcode'];
394 394 $language = \Drupal::languageManager()->getLanguage($langcode);
395 $message['subject'] .= t('New release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name')], ['langcode' => $langcode]);
395
396 // Set the message subject.
397 $subject = '';
398 $all_reasons = array_unique(array_values($params));
399 // If any reason is security then use the security subject.
  • 394 394 $language = \Drupal::languageManager()->getLanguage($langcode);
    395 $message['subject'] .= t('New release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name')], ['langcode' => $langcode]);
    395
    396 // Set the message subject.
    397 $subject = '';
    398 $all_reasons = array_unique(array_values($params));
    399 // If any reason is security then use the security subject.
    400 $security = array_filter($all_reasons, function ($item) {
    401 return in_array($item, [UpdateManagerInterface::NOT_SECURE, UpdateManagerInterface::REVOKED]);
    402 });
    403 if ($security) {
    404 $subject = t('Security release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name'), 'langcode' => $langcode]);
    405 }
    406
    407 // If no subject yet then check for fetch failures. If all the reasons
    408 // are fetch failures the use the fetch subject.
  • 404 $subject = t('Security release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name'), 'langcode' => $langcode]);
    405 }
    406
    407 // If no subject yet then check for fetch failures. If all the reasons
    408 // are fetch failures the use the fetch subject.
    409 if (empty($subject)) {
    410 $fetch = array_filter($all_reasons, function ($item) {
    411 return $item > 0;
    412 });
    413 if (empty($fetch) && !empty($all_reasons)) {
    414 $subject = t('Failed to get release information for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name'), 'langcode' => $langcode]);
    415 }
    416 }
    417
    418 // If still no subject, then there are non-security updates and use the non-
    419 // security subject. Then update the subject in the existing message.
  • Jess
    Jess @xjm started a thread on the diff
  • 408 // are fetch failures the use the fetch subject.
    409 if (empty($subject)) {
    410 $fetch = array_filter($all_reasons, function ($item) {
    411 return $item > 0;
    412 });
    413 if (empty($fetch) && !empty($all_reasons)) {
    414 $subject = t('Failed to get release information for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name'), 'langcode' => $langcode]);
    415 }
    416 }
    417
    418 // If still no subject, then there are non-security updates and use the non-
    419 // security subject. Then update the subject in the existing message.
    420 if (empty($subject)) {
    421 $subject = t('New release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name'), 'langcode' => $langcode]);
    422 }
    423 $message['subject'] .= $subject;
  • 76 77 *
    77 78 * @dataProvider providerTestUpdateEmail
    78 79 */
    79 public function testUpdateEmail($notification_threshold, $params, $authorized, array $expected_body) {
    80 public function testUpdateEmail($notification_threshold, $params, $authorized, $expected_subject, array $expected_body) {
  • added 1 commit

    • 7c880d4b - Issue #1818764 by xurizaemon, quietone, haydeniv, amitgoyal, smustgrave, xjm,...

    Compare with previous version

  • Please register or sign in to reply
    Loading