Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 22, 2020
1 parent ffb70a3 commit 87b4bf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/HasTeams.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,9 @@ public function hasTeamRole($team, string $role)
return true;
}

if (! $this->belongsToTeam($team)) {
return false;
}

$roleObject = Jetstream::findRole($team->users->where(
return $this->belongsToTeam($team) && optional(Jetstream::findRole($team->users->where(
'id', $this->id
)->first()->membership->role);

if (! $roleObject) {
return false;
}

return $roleObject->key === $role;
)->first()->membership->role))->key === $role;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/AddTeamMemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function test_team_members_can_be_added()
$this->assertCount(1, $team->users);

$this->assertTrue($otherUser->hasTeamRole($team, 'admin'));
$this->assertFalse($otherUser->hasTeamRole($team, 'editor'));
$this->assertFalse($otherUser->hasTeamRole($team, 'foobar'));

$team->users->first()->withAccessToken(new TransientToken);

Expand Down

0 comments on commit 87b4bf3

Please sign in to comment.