- Added flag to mute default social activities at content creation.

Setting muteDefaultSocialActivities to true, will deactivate 
the creation of the default social activities like Activity and 
Notification in the afterSave() method for this content object.
This commit is contained in:
Sebastian Stumpf 2017-08-30 14:32:56 +02:00
parent 7f856ff26d
commit 61e759f330
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@ HumHub Change Log
Important note for LDAP users: There is a new setting "ID Attribute" which should be set to clearly identify users.
- Enh: Added flag to control automatically created social activities at content creation.
- Enh: Fixed registration approval/denial mails and made their default value configurable.
- Enh: Updated primary auth client interface for more flexibility
- Enh: Added LDAP ID attribute to improve user mapping

View File

@ -71,6 +71,11 @@ class Content extends ContentDeprecated
* @var ContentContainerActiveRecord the Container (e.g. Space or User) where this content belongs to.
*/
protected $_container = null;
/**
* @var bool flag to disable the creation of default social activities like activity and notifications in afterSave() at content creation.
*/
public $muteDefaultSocialActivities = false;
/**
* @inheritdoc
@ -176,14 +181,14 @@ class Content extends ContentDeprecated
if ($insert && !$contentSource instanceof \humhub\modules\activity\models\Activity) {
if ($this->container !== null) {
if (!$this->muteDefaultSocialActivities && $this->container !== null) {
$notifyUsers = array_merge($this->notifyUsersOfNewContent, Yii::$app->notification->getFollowers($this));
\humhub\modules\content\notifications\ContentCreated::instance()
->from($this->user)
->about($contentSource)
->sendBulk($notifyUsers);
\humhub\modules\content\activities\ContentCreated::instance()
->from($this->user)
->about($contentSource)->save();