fix(regression): queryVisibleTo accepts nullable actor

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
Sami Mazouz 2023-05-16 19:17:07 +01:00
parent 231cee1f78
commit bded3da42d
No known key found for this signature in database
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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();