mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 02:10:09 +08:00
fix(regression): queryVisibleTo
accepts nullable actor
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
parent
231cee1f78
commit
bded3da42d
|
@ -26,7 +26,7 @@ class TagRepository
|
||||||
return Tag::query();
|
return Tag::query();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function queryVisibleTo(User $actor): Builder
|
public function queryVisibleTo(?User $actor = null): Builder
|
||||||
{
|
{
|
||||||
return $this->scopeVisibleTo($this->query(), $actor);
|
return $this->scopeVisibleTo($this->query(), $actor);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ class TagRepository
|
||||||
* @param User|null $user
|
* @param User|null $user
|
||||||
* @return Builder<Tag>
|
* @return Builder<Tag>
|
||||||
*/
|
*/
|
||||||
protected function scopeVisibleTo(Builder $query, User $user = null)
|
protected function scopeVisibleTo(Builder $query, ?User $user = null)
|
||||||
{
|
{
|
||||||
if ($user !== null) {
|
if ($user !== null) {
|
||||||
$query->whereVisibleTo($user);
|
$query->whereVisibleTo($user);
|
||||||
|
|
|
@ -41,7 +41,7 @@ class GroupRepository
|
||||||
return $this->scopeVisibleTo($query, $actor)->firstOrFail();
|
return $this->scopeVisibleTo($query, $actor)->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function queryVisibleTo(User $actor = null)
|
public function queryVisibleTo(?User $actor = null)
|
||||||
{
|
{
|
||||||
return $this->scopeVisibleTo($this->query(), $actor);
|
return $this->scopeVisibleTo($this->query(), $actor);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class GroupRepository
|
||||||
* @param User|null $actor
|
* @param User|null $actor
|
||||||
* @return Builder<Group>
|
* @return Builder<Group>
|
||||||
*/
|
*/
|
||||||
protected function scopeVisibleTo(Builder $query, User $actor = null)
|
protected function scopeVisibleTo(Builder $query, ?User $actor = null)
|
||||||
{
|
{
|
||||||
if ($actor !== null) {
|
if ($actor !== null) {
|
||||||
$query->whereVisibleTo($actor);
|
$query->whereVisibleTo($actor);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class PostRepository
|
||||||
* @param User|null $user
|
* @param User|null $user
|
||||||
* @return Builder<Post>
|
* @return Builder<Post>
|
||||||
*/
|
*/
|
||||||
public function queryVisibleTo(User $user = null)
|
public function queryVisibleTo(?User $user = null)
|
||||||
{
|
{
|
||||||
$query = $this->query();
|
$query = $this->query();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user