fix: [required taxonomies] not firing via regular publishing only via publish (no email), fixes #4546

pull/4554/head
iglocska 2019-04-30 09:56:16 +02:00
parent b671306059
commit 18104c0a08
1 changed files with 7 additions and 0 deletions

View File

@ -2488,6 +2488,13 @@ class EventsController extends AppController
$errors = array();
// only allow form submit CSRF protection
if ($this->request->is('post') || $this->request->is('put')) {
if (!$this->_isRest()) {
$publishable = $this->Event->checkIfPublishable($id);
if ($publishable !== true) {
$this->Flash->error(__('Could not publish event - no tag for required taxonomies missing: %s', implode(', ', $publishable)));
$this->redirect(array('action' => 'view', $id));
}
}
// send out the email
$emailResult = $this->Event->sendAlertEmailRouter($id, $this->Auth->user(), $this->Event->data['Event']['publish_timestamp']);
if (is_bool($emailResult) && $emailResult == true) {