From 446efa46250ae92ee038aaa76967aee21450a082 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 23 Apr 2018 11:50:30 +0200 Subject: [PATCH] Only query last comment info, when there is one Signed-off-by: Joas Schilling --- lib/private/Comments/Manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 9393cce334d..d96c22aad51 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -407,11 +407,11 @@ class Manager implements ICommentsManager { $query->setMaxResults($limit); } - $lastKnownComment = $this->getLastKnownComment( + $lastKnownComment = $lastKnownCommentId > 0 ? $this->getLastKnownComment( $objectType, $objectId, $lastKnownCommentId - ); + ) : null; if ($lastKnownComment instanceof IComment) { $lastKnownCommentDateTime = $lastKnownComment->getCreationDateTime(); if ($sortDirection === 'desc') {