Commit d27b7aa2 authored by Jacob Rockowitz's avatar Jacob Rockowitz Committed by Jacob Rockowitz
Browse files

Issue #3040972 by ThomasVaRo, jrockowitz: [email-handler] Add locked state reaction

parent 3cbe9981
Loading
Loading
Loading
Loading
+1
Changes for src/Plugin/WebformHandler/EmailWebformHandler.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -721,6 +721,7 @@ class EmailWebformHandler extends WebformHandlerBase implements WebformHandlerMe
        WebformSubmissionInterface::STATE_COMPLETED => $this->t('…when submission is <b>completed</b>.'),
        WebformSubmissionInterface::STATE_UPDATED => $this->t('…when submission is <b>updated</b>.'),
        WebformSubmissionInterface::STATE_DELETED => $this->t('…when submission is <b>deleted</b>.'),
        WebformSubmissionInterface::STATE_LOCKED => $this->t('…when submission is <b>locked</b>.'),
      ],
      '#access' => $results_disabled ? FALSE : TRUE,
      '#default_value' => $results_disabled ? [WebformSubmissionInterface::STATE_COMPLETED] : $this->configuration['states'],
+5
Changes for src/Tests/Handler/WebformHandlerEmailStatesTest.php: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -53,9 +53,14 @@ class WebformHandlerEmailStatesTest extends WebformTestBase {
    $this->assertRaw('<b>Subject:</b> Submission converted<br />');
    $this->assertRaw('<b>Subject:</b> Submission completed<br />');
    $this->assertRaw('<b>Subject:</b> Submission updated<br />');
    $this->assertRaw('<b>Subject:</b> Submission locked<br />');
    $this->assertRaw('<b>Subject:</b> Submission deleted<br />');
    $this->assertRaw('<b>Subject:</b> Submission custom<br />');

    // Check locked email.
    $this->drupalPostForm("/admin/structure/webform/manage/test_handler_email_states/submission/$sid/notes", ['locked' => TRUE], t('Save'));
    $this->assertRaw('Debug: Email: Submission locked');

    // Check deleted email.
    $this->drupalPostForm("/admin/structure/webform/manage/test_handler_email_states/submission/$sid/delete", [], t('Delete'));
    $this->assertRaw('Debug: Email: Submission deleted');
+34
Changes for tests/modules/webform_test/config/install/webform.webform.test_handler_email_states.yml: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -307,6 +307,40 @@ handlers:
      return_path: ''
      sender_mail: ''
      sender_name: ''
  email_locked:
    id: email
    label: 'Submission locked'
    handler_id: email_locked
    status: true
    conditions: {  }
    weight: 3
    settings:
      states:
        - locked
      to_mail: locked@example.com
      to_options: {  }
      cc_mail: ''
      cc_options: {  }
      bcc_mail: ''
      bcc_options: {  }
      from_mail: _default
      from_options: {  }
      from_name: _default
      subject: 'Submission locked'
      body: _default
      excluded_elements: {  }
      ignore_access: false
      exclude_empty: true
      exclude_empty_checkbox: false
      html: true
      attachments: false
      twig: false
      theme_name: ''
      debug: true
      reply_to: ''
      return_path: ''
      sender_mail: ''
      sender_name: ''
  email_deleted:
    id: email
    label: 'Submission deleted'