Only query last comment info, when there is one

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-04-23 11:50:30 +02:00
parent 3ff041f86d
commit 446efa4625
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA

View file

@ -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') {