diff --git a/protected/humhub/modules/notification/targets/BaseTarget.php b/protected/humhub/modules/notification/targets/BaseTarget.php index 49fa35410e..252c246afa 100644 --- a/protected/humhub/modules/notification/targets/BaseTarget.php +++ b/protected/humhub/modules/notification/targets/BaseTarget.php @@ -9,6 +9,8 @@ namespace humhub\modules\notification\targets; use Yii; +use yii\base\Object; +use yii\di\Instance; use humhub\modules\user\models\User; use humhub\components\rendering\Renderer; use humhub\modules\notification\components\BaseNotification; @@ -21,7 +23,7 @@ use humhub\modules\notification\components\NotificationCategory; * * @author buddha */ -abstract class BaseTarget extends \yii\base\Object +abstract class BaseTarget extends Object { /** @@ -71,14 +73,14 @@ abstract class BaseTarget extends \yii\base\Object /** * @return string Human readable title for views. */ - public abstract function getTitle(); + abstract public function getTitle(); /** * @return \humhub\components\rendering\Renderer default renderer for this target. */ public function getRenderer() { - return \yii\di\Instance::ensure($this->renderer, Renderer::class); + return Instance::ensure($this->renderer, Renderer::class); } /** @@ -89,7 +91,7 @@ abstract class BaseTarget extends \yii\base\Object * * @param BaseNotification $notification */ - public abstract function handle(BaseNotification $notification, User $user); + abstract public function handle(BaseNotification $notification, User $user); /** * Used to acknowledge the seding/processing of the given $notification. @@ -113,6 +115,7 @@ abstract class BaseTarget extends \yii\base\Object if ($this->acknowledgeFlag && $notification->record->hasAttribute($this->acknowledgeFlag)) { return $notification->record->getAttribute($this->acknowledgeFlag); } + return false; } @@ -215,6 +218,7 @@ abstract class BaseTarget extends \yii\base\Object } $category = $notification->getCategory(); + return ($category) ? $this->isCategoryEnabled($category, $user) : $this->defaultSetting; }