fixes #1695, take into consideration is_private with counts on User stats

This commit is contained in:
Daniël Klabbers 2019-07-28 20:59:12 +02:00
parent c881f9f633
commit 3611fa1bb9

View File

@ -687,7 +687,10 @@ class User extends AbstractModel
*/ */
public function refreshCommentCount() 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; return $this;
} }
@ -699,7 +702,9 @@ class User extends AbstractModel
*/ */
public function refreshDiscussionCount() public function refreshDiscussionCount()
{ {
$this->discussion_count = $this->discussions()->count(); $this->discussion_count = $this->discussions()
->where('is_private', false)
->count();
return $this; return $this;
} }