From 7af546ee74984d2cc5bc14ca4728e7db780421c5 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Thu, 4 Oct 2018 15:05:23 +0200 Subject: [PATCH] Fix: Comment edit triggers new activity --- protected/humhub/docs/CHANGELOG.md | 1 + protected/humhub/modules/comment/models/Comment.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index d5a4bc44cd..0bafbf2a87 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -8,6 +8,7 @@ HumHub Change Log - Fix: Hide unapproved member activities - Fix #3313: Unable to deny invitation to private space - Fix: Added missing `parent::init()` to `humhub\modules\stream\widgets\StreamViewer` +- Fix: Comment edit triggers new activity 1.3.4 (September 25, 2018) diff --git a/protected/humhub/modules/comment/models/Comment.php b/protected/humhub/modules/comment/models/Comment.php index a82d0cb867..a32148ed3a 100644 --- a/protected/humhub/modules/comment/models/Comment.php +++ b/protected/humhub/modules/comment/models/Comment.php @@ -120,13 +120,15 @@ class Comment extends ContentAddonActiveRecord implements ContentOwner * @param bool $insert * @param array $changedAttributes * @return bool + * @throws Exception */ public function afterSave($insert, $changedAttributes) { $this->flushCache(); - - // Creating activity - NewComment::instance()->about($this)->save(); + + if($insert) { + NewComment::instance()->about($this)->create(); + } // Handle mentioned users // Execute before NewCommentNotification to avoid double notification when mentioned.