mirror of
https://github.com/koel/koel
synced 2024-11-14 00:17:13 +00:00
fix: broken route:list command (#1859)
This commit is contained in:
parent
793b59e9cf
commit
f017b82479
1 changed files with 5 additions and 5 deletions
|
@ -17,13 +17,9 @@ use Illuminate\Support\Facades\DB;
|
|||
|
||||
class PlaylistCollaborationService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
License::requirePlus();
|
||||
}
|
||||
|
||||
public function createToken(Playlist $playlist): PlaylistCollaborationToken
|
||||
{
|
||||
License::requirePlus();
|
||||
throw_if($playlist->is_smart, OperationNotApplicableForSmartPlaylistException::class);
|
||||
|
||||
return $playlist->collaborationTokens()->create();
|
||||
|
@ -31,6 +27,7 @@ class PlaylistCollaborationService
|
|||
|
||||
public function acceptUsingToken(string $token, User $user): Playlist
|
||||
{
|
||||
License::requirePlus();
|
||||
$collaborationToken = PlaylistCollaborationToken::query()->where('token', $token)->firstOrFail();
|
||||
|
||||
throw_if($collaborationToken->expired, PlaylistCollaborationTokenExpiredException::class);
|
||||
|
@ -51,6 +48,8 @@ class PlaylistCollaborationService
|
|||
/** @return Collection<array-key, PlaylistCollaborator> */
|
||||
public function getCollaborators(Playlist $playlist): Collection
|
||||
{
|
||||
License::requirePlus();
|
||||
|
||||
return $playlist->collaborators->unless(
|
||||
$playlist->collaborators->contains($playlist->user), // The owner is always a collaborator
|
||||
static fn (Collection $collaborators) => $collaborators->push($playlist->user)
|
||||
|
@ -60,6 +59,7 @@ class PlaylistCollaborationService
|
|||
|
||||
public function removeCollaborator(Playlist $playlist, User $user): void
|
||||
{
|
||||
License::requirePlus();
|
||||
throw_if($user->is($playlist->user), CannotRemoveOwnerFromPlaylistException::class);
|
||||
throw_if(!$playlist->hasCollaborator($user), NotAPlaylistCollaboratorException::class);
|
||||
|
||||
|
|
Loading…
Reference in a new issue