diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-02-05 12:39:07 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-02-05 12:39:07 +0100 |
commit | 4056cca427549e645cbd0515500914b50feae01a (patch) | |
tree | 6a80e835925785dade0dbcd9f1e79dd6d497a08a /lib/private | |
parent | 733db5c14a5bf882fab5ba2401467771bc58ef63 (diff) | |
download | nextcloud-server-4056cca427549e645cbd0515500914b50feae01a.tar.gz nextcloud-server-4056cca427549e645cbd0515500914b50feae01a.zip |
Only dispatch the delete event, when the deletion was successful
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/comments/manager.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/private/comments/manager.php b/lib/private/comments/manager.php index 21baeb6fee3..36b2d9d08b8 100644 --- a/lib/private/comments/manager.php +++ b/lib/private/comments/manager.php @@ -436,12 +436,6 @@ class Manager implements ICommentsManager { // Ignore exceptions, we just don't fire a hook then $comment = null; } - if ($comment instanceof IComment) { - $this->dispatcher->dispatch(CommentsEvent::EVENT_DELETE, new CommentsEvent( - CommentsEvent::EVENT_DELETE, - $comment - )); - } $qb = $this->dbConn->getQueryBuilder(); $query = $qb->delete('comments') @@ -455,6 +449,14 @@ class Manager implements ICommentsManager { $this->logger->logException($e, ['app' => 'core_comments']); return false; } + + if ($affectedRows > 0 && $comment instanceof IComment) { + $this->dispatcher->dispatch(CommentsEvent::EVENT_DELETE, new CommentsEvent( + CommentsEvent::EVENT_DELETE, + $comment + )); + } + return ($affectedRows > 0); } |