Commit 9b7b2ee4 authored by alexpott's avatar alexpott

Issue #2687507 by ajalan065, nicobot, sidharthap, Berdir: Send emails before saving the message

parent 03cd7e5e
......@@ -213,6 +213,10 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
public function save(array $form, FormStateInterface $form_state) {
$message = $this->entity;
$user = $this->currentUser();
// Save the message. In core this is a no-op but should contrib wish to
// implement message storage, this will make the task of swapping in a real
// storage controller straight-forward.
$message->save();
$this->mailHandler->sendMailMessages($message, $user);
$contact_form = $message->getContactForm();
......@@ -229,10 +233,6 @@ public function save(array $form, FormStateInterface $form_state) {
else {
$form_state->setRedirectUrl($contact_form->getRedirectUrl());
}
// Save the message. In core this is a no-op but should contrib wish to
// implement message storage, this will make the task of swapping in a real
// storage controller straight-forward.
$message->save();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment