mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 06:03:39 +08:00
Let users see themselves even if they can't see the forum
This commit is contained in:
parent
5f56410e04
commit
c6d0bc85f6
|
@ -15,7 +15,11 @@ trait VisibleScope
|
||||||
public function scopeWhereVisibleTo(Builder $query, User $actor)
|
public function scopeWhereVisibleTo(Builder $query, User $actor)
|
||||||
{
|
{
|
||||||
if (! app('flarum.forum')->can($actor, 'view')) {
|
if (! app('flarum.forum')->can($actor, 'view')) {
|
||||||
|
if ($this instanceof User) {
|
||||||
|
$query->where('id', $actor->id);
|
||||||
|
} else {
|
||||||
$query->whereRaw('FALSE');
|
$query->whereRaw('FALSE');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event(new ScopeModelVisibility($this, $query, $actor));
|
event(new ScopeModelVisibility($this, $query, $actor));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user