summaryrefslogtreecommitdiffstats
path: root/apps/comments/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2016-10-08 01:10:49 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2016-10-08 01:10:49 +0200
commita35d4e7b44764c2eebec77c8b4e8de2636c60cad (patch)
tree1a2ff9b735e5ddb6115d05164ae616d524428fff /apps/comments/lib
parent006da9afd725060d48fd81893094256ddced0099 (diff)
downloadnextcloud-server-a35d4e7b44764c2eebec77c8b4e8de2636c60cad.tar.gz
nextcloud-server-a35d4e7b44764c2eebec77c8b4e8de2636c60cad.zip
remove notifications of deleted comments from the DB
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/comments/lib')
-rw-r--r--apps/comments/lib/EventHandler.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/comments/lib/EventHandler.php b/apps/comments/lib/EventHandler.php
index a32bb8ffa71..6692ccc520d 100644
--- a/apps/comments/lib/EventHandler.php
+++ b/apps/comments/lib/EventHandler.php
@@ -53,12 +53,20 @@ class EventHandler implements ICommentsEventHandler {
return;
}
- if( $event->getEvent() === CommentsEvent::EVENT_ADD
+ $eventType = $event->getEvent();
+ if( $eventType === CommentsEvent::EVENT_ADD
&& $event instanceof CommentsEvent
) {
$this->onAdd($event);
return;
}
+
+ if( $eventType === CommentsEvent::EVENT_DELETE
+ && $event instanceof CommentsEvent
+ ) {
+ $this->onDelete($event);
+ return;
+ }
}
/**
@@ -75,4 +83,15 @@ class EventHandler implements ICommentsEventHandler {
$activityListener = $c->query(ActivityListener::class);
$activityListener->commentEvent($event);
}
+
+ /**
+ * @param CommentsEvent $event
+ */
+ private function onDelete(CommentsEvent $event) {
+ $c = $this->app->getContainer();
+
+ /** @var NotificationListener $notificationListener */
+ $notificationListener = $c->query(NotificationListener::class);
+ $notificationListener->evaluate($event);
+ }
}