diff options
| -rw-r--r-- | lib/models/BlubberThread.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php index 371423f..510170e 100644 --- a/lib/models/BlubberThread.php +++ b/lib/models/BlubberThread.php @@ -1105,11 +1105,13 @@ class BlubberThread extends SimpleORMap implements PrivacyObject */ public function countUnseenComments(string $user_id = null): int { + $user_id = $user_id ?? User::findCurrent(); return \BlubberComment::countBySQL( - 'thread_id = ? AND mkdate >= ?', + 'thread_id = ? AND mkdate >= ? AND user_id != ?', [ $this->getId(), - $this->getLastVisit($user_id ?? $GLOBALS['user']->id) ?: object_get_visit_threshold(), + $this->getLastVisit($user_id) ?: object_get_visit_threshold(), + $user_id ] ); } |
