diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-10-08 01:10:49 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-10-08 01:10:49 +0200 |
commit | a35d4e7b44764c2eebec77c8b4e8de2636c60cad (patch) | |
tree | 1a2ff9b735e5ddb6115d05164ae616d524428fff /apps/comments/lib | |
parent | 006da9afd725060d48fd81893094256ddced0099 (diff) | |
download | nextcloud-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.php | 21 |
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); + } } |