From 1bcd2ca8e35dca6e68e5f06506ade0a78a2beae8 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 12 Oct 2016 18:06:22 +0200 Subject: emit pre-update event for comments * notifications can be cleaned up, no polluted DB * updating comments will re-notify users or remove notifications, depending on the message Signed-off-by: Arthur Schiwon --- lib/private/Comments/Manager.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/private/Comments') diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index f7b23dd5f58..b3ecab731e1 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -536,6 +536,12 @@ class Manager implements ICommentsManager { * @throws NotFoundException */ protected function update(IComment $comment) { + // for properly working preUpdate Events we need the old comments as is + // in the DB and overcome caching. Also avoid that outdated information stays. + $this->uncache($comment->getId()); + $this->sendEvent(CommentsEvent::EVENT_PRE_UPDATE, $this->get($comment->getId())); + $this->uncache($comment->getId()); + $qb = $this->dbConn->getQueryBuilder(); $affectedRows = $qb ->update('comments') -- cgit v1.2.3