Let users see themselves even if they can't see the forum

This commit is contained in:
Toby Zerner 2015-08-05 18:12:09 +09:30
parent 5f56410e04
commit c6d0bc85f6

View File

@ -15,7 +15,11 @@ trait VisibleScope
public function scopeWhereVisibleTo(Builder $query, User $actor)
{
if (! app('flarum.forum')->can($actor, 'view')) {
if ($this instanceof User) {
$query->where('id', $actor->id);
} else {
$query->whereRaw('FALSE');
}
} else {
event(new ScopeModelVisibility($this, $query, $actor));
}