summaryrefslogtreecommitdiff
path: root/app/Subscriber/NotificationSubscriber.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Subscriber/NotificationSubscriber.php')
-rw-r--r--app/Subscriber/NotificationSubscriber.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php
index 1bde24dd..6c24b08c 100644
--- a/app/Subscriber/NotificationSubscriber.php
+++ b/app/Subscriber/NotificationSubscriber.php
@@ -2,7 +2,6 @@
namespace Kanboard\Subscriber;
-use Kanboard\Core\Base;
use Kanboard\Event\GenericEvent;
use Kanboard\Model\Task;
use Kanboard\Model\Comment;
@@ -10,7 +9,7 @@ use Kanboard\Model\Subtask;
use Kanboard\Model\File;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class NotificationSubscriber extends Base implements EventSubscriberInterface
+class NotificationSubscriber extends BaseSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
@@ -35,14 +34,17 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
public function handleEvent(GenericEvent $event, $event_name)
{
- $event_data = $this->getEventData($event);
+ if (! $this->isExecuted()) {
+ $this->logger->debug('Subscriber executed: '.__CLASS__.'::'.__METHOD__);
+ $event_data = $this->getEventData($event);
- if (! empty($event_data)) {
- if (! empty($event['mention'])) {
- $this->userNotification->sendUserNotification($event['mention'], $event_name, $event_data);
- } else {
- $this->userNotification->sendNotifications($event_name, $event_data);
- $this->projectNotification->sendNotifications($event_data['task']['project_id'], $event_name, $event_data);
+ if (! empty($event_data)) {
+ if (! empty($event['mention'])) {
+ $this->userNotification->sendUserNotification($event['mention'], $event_name, $event_data);
+ } else {
+ $this->userNotification->sendNotifications($event_name, $event_data);
+ $this->projectNotification->sendNotifications($event_data['task']['project_id'], $event_name, $event_data);
+ }
}
}
}