From 3611fa1bb98c794c12399ebc733ba0c0b13062df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Sun, 28 Jul 2019 20:59:12 +0200 Subject: [PATCH] fixes #1695, take into consideration is_private with counts on User stats --- src/User/User.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/User/User.php b/src/User/User.php index f8fd3e0b2..c8d7821bf 100644 --- a/src/User/User.php +++ b/src/User/User.php @@ -687,7 +687,10 @@ class User extends AbstractModel */ public function refreshCommentCount() { - $this->comment_count = $this->posts()->where('type', 'comment')->count(); + $this->comment_count = $this->posts() + ->where('type', 'comment') + ->where('is_private', false) + ->count(); return $this; } @@ -699,7 +702,9 @@ class User extends AbstractModel */ public function refreshDiscussionCount() { - $this->discussion_count = $this->discussions()->count(); + $this->discussion_count = $this->discussions() + ->where('is_private', false) + ->count(); return $this; }