diff --git a/pkg/api/playlist.go b/pkg/api/playlist.go index 7aa3c7d0057..a6c2da26dd8 100644 --- a/pkg/api/playlist.go +++ b/pkg/api/playlist.go @@ -26,6 +26,18 @@ func ValidateOrgPlaylist(c *middleware.Context) { c.JsonApiErr(403, "You are not allowed to edit/view playlist", nil) return } + + items, itemsErr := LoadPlaylistItemDTOs(id) + + if itemsErr != nil { + c.JsonApiErr(404, "Playlist items not found", err) + return + } + + if len(items) == 0 { + c.JsonApiErr(404, "Playlist is empty", itemsErr) + return + } } func SearchPlaylists(c *middleware.Context) Response { diff --git a/pkg/services/sqlstore/dashboard.go b/pkg/services/sqlstore/dashboard.go index e9f98a04471..7bd65ac4da8 100644 --- a/pkg/services/sqlstore/dashboard.go +++ b/pkg/services/sqlstore/dashboard.go @@ -233,6 +233,7 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error { "DELETE FROM dashboard_tag WHERE dashboard_id = ? ", "DELETE FROM star WHERE dashboard_id = ? ", "DELETE FROM dashboard WHERE id = ?", + "DELETE FROM playlist_item WHERE type = 'dashboard_by_id' AND value = ?", } for _, sql := range deletes {