From 720c88e73a75fd2485895efc4a09de0ed95b719e 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 --- framework/core/src/User/User.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/framework/core/src/User/User.php b/framework/core/src/User/User.php index 161db365f..4a5465b15 100644 --- a/framework/core/src/User/User.php +++ b/framework/core/src/User/User.php @@ -757,7 +757,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; } @@ -769,7 +772,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; }