diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index dc7971af..db72f70d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ========= +1.0.15 - March 28, 2020 +----------------------- +- Fix #173: New message creation notification fails + 1.0.14 - March 17, 2020 ----------------------- diff --git a/models/forms/CreateMessage.php b/models/forms/CreateMessage.php index 382150e5..6ec68860 100644 --- a/models/forms/CreateMessage.php +++ b/models/forms/CreateMessage.php @@ -107,6 +107,11 @@ public function save() return false; } + if (!$this->informRecipients()) { + $transaction->rollBack(); + return false; + } + if(!$this->saveOriginatorUserMessage()) { $transaction->rollBack(); return false; @@ -128,16 +133,18 @@ public function save() private function saveRecipients() { - $recepients = []; // Attach also Recipients foreach ($this->getRecipients() as $recipient) { - if ($this->messageInstance->addRecepient($recipient)) { - $recepients[] = $recipient; - } + $this->messageInstance->addRecepient($recipient); } + return true; + } + + private function informRecipients() { + // Inform recipients (We need to add all before) - foreach ($recepients as $recipient) { + foreach ($this->getRecipients() as $recipient) { try { $this->messageInstance->notify($recipient); } catch (\Exception $e) { diff --git a/module.json b/module.json index c038658e..a0d1547e 100644 --- a/module.json +++ b/module.json @@ -3,7 +3,7 @@ "name": "Mail", "description": "A private messaging system for direct communication", "keywords": ["mail", "messaging", "communication"], - "version": "1.0.14", + "version": "1.0.15", "humhub": { "minVersion": "1.3.3" },