From c6d0bc85f6887d19837883bb13c9f67ba8cdd801 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 5 Aug 2015 18:12:09 +0930 Subject: [PATCH] Let users see themselves even if they can't see the forum --- framework/core/src/Core/Support/VisibleScope.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Core/Support/VisibleScope.php b/framework/core/src/Core/Support/VisibleScope.php index 00f6135d5..dec71b2bf 100644 --- a/framework/core/src/Core/Support/VisibleScope.php +++ b/framework/core/src/Core/Support/VisibleScope.php @@ -15,7 +15,11 @@ trait VisibleScope public function scopeWhereVisibleTo(Builder $query, User $actor) { if (! app('flarum.forum')->can($actor, 'view')) { - $query->whereRaw('FALSE'); + if ($this instanceof User) { + $query->where('id', $actor->id); + } else { + $query->whereRaw('FALSE'); + } } else { event(new ScopeModelVisibility($this, $query, $actor)); }