Пример #1
0
 /**
  * Before Save Addons
  *
  * @return type
  */
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     // Handle mentioned users
     \humhub\modules\user\models\Mentioning::parse($this, $this->message);
     return true;
 }
Пример #2
0
 /**
  * After Saving of comments, fire an activity
  *
  * @return type
  */
 public function afterSave($insert, $changedAttributes)
 {
     // flush the cache
     $this->flushCache();
     $activity = new \humhub\modules\comment\activities\NewComment();
     $activity->source = $this;
     $activity->create();
     // Handle mentioned users
     // Execute before NewCommentNotification to avoid double notification when mentioned.
     \humhub\modules\user\models\Mentioning::parse($this, $this->message);
     if ($insert) {
         $notification = new \humhub\modules\comment\notifications\NewComment();
         $notification->source = $this;
         $notification->originator = $this->user;
         $notification->sendBulk($this->content->getPolymorphicRelation()->getFollowers(null, true, true));
     }
     $this->updateContentSearch();
     return parent::afterSave($insert, $changedAttributes);
 }