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

8.3.x
Alex Pott 2017-01-19 13:12:59 +00:00
parent 03cd7e5ee5
commit 9b7b2ee4f6
1 changed files with 4 additions and 4 deletions

View File

@ -213,6 +213,10 @@ class MessageForm extends ContentEntityForm {
public function save(array $form, FormStateInterface $form_state) { public function save(array $form, FormStateInterface $form_state) {
$message = $this->entity; $message = $this->entity;
$user = $this->currentUser(); $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); $this->mailHandler->sendMailMessages($message, $user);
$contact_form = $message->getContactForm(); $contact_form = $message->getContactForm();
@ -229,10 +233,6 @@ class MessageForm extends ContentEntityForm {
else { else {
$form_state->setRedirectUrl($contact_form->getRedirectUrl()); $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();
} }
} }