diff --git a/app/Actions/Http/Api/List/Playlist/Track/DestroyTrackAction.php b/app/Actions/Http/Api/List/Playlist/Track/DestroyTrackAction.php index 2115b2fed..281e1a4a1 100644 --- a/app/Actions/Http/Api/List/Playlist/Track/DestroyTrackAction.php +++ b/app/Actions/Http/Api/List/Playlist/Track/DestroyTrackAction.php @@ -25,7 +25,7 @@ class DestroyTrackAction // Lock tracks to prevent race conditions. Playlist::query()->whereKey($playlist->getKey())->lockForUpdate()->first(); - $playlist->tracks()->getQuery()->lockForUpdate()->count(); + $playlist->tracks()->select(PlaylistTrack::ATTRIBUTE_ID)->lockForUpdate()->get(); $removeAction = new RemoveTrackAction(); diff --git a/app/Actions/Http/Api/List/Playlist/Track/StoreTrackAction.php b/app/Actions/Http/Api/List/Playlist/Track/StoreTrackAction.php index 34f78453e..9ab0b1967 100644 --- a/app/Actions/Http/Api/List/Playlist/Track/StoreTrackAction.php +++ b/app/Actions/Http/Api/List/Playlist/Track/StoreTrackAction.php @@ -36,7 +36,7 @@ class StoreTrackAction // Lock tracks to prevent race conditions. Playlist::query()->whereKey($playlist->getKey())->lockForUpdate()->first(); - $playlist->tracks()->getQuery()->lockForUpdate()->count(); + $playlist->tracks()->select(PlaylistTrack::ATTRIBUTE_ID)->lockForUpdate()->get(); /** @var StoreAction $storeAction */ $storeAction = new StoreAction(); diff --git a/app/Actions/Http/Api/List/Playlist/Track/UpdateTrackAction.php b/app/Actions/Http/Api/List/Playlist/Track/UpdateTrackAction.php index 7f00166c1..f8704cfdd 100644 --- a/app/Actions/Http/Api/List/Playlist/Track/UpdateTrackAction.php +++ b/app/Actions/Http/Api/List/Playlist/Track/UpdateTrackAction.php @@ -33,7 +33,7 @@ class UpdateTrackAction // Lock tracks to prevent race conditions. Playlist::query()->whereKey($playlist->getKey())->lockForUpdate()->first(); - $playlist->tracks()->getQuery()->lockForUpdate()->count(); + $playlist->tracks()->select(PlaylistTrack::ATTRIBUTE_ID)->lockForUpdate()->get(); /** @var UpdateAction $updateAction */ $updateAction = new UpdateAction(); diff --git a/app/Discord/DiscordEmbedField.php b/app/Discord/DiscordEmbedField.php index 02278d6c6..ffe3d1e57 100644 --- a/app/Discord/DiscordEmbedField.php +++ b/app/Discord/DiscordEmbedField.php @@ -79,10 +79,15 @@ class DiscordEmbedField implements Arrayable, JsonSerializable } // Encode to json for all other non-empty scalar values - if ((is_scalar($value) || $value instanceof Stringable) && Str::length($value) > 0) { + if (is_scalar($value) && Str::length($value) > 0) { return strval($value); } + // Convert Stringable objects to string + if ($value instanceof Stringable && filled($value)) { + return (string) $value; + } + return self::DEFAULT_FIELD_VALUE; } }