Commit d670f1b9 by Carl Bergquist Committed by GitHub

Merge pull request #6479 from utkarshcmu/playlist_bug

Removed playlist item when dashboard is deleted
parents b8879113 c737704e
...@@ -26,6 +26,18 @@ func ValidateOrgPlaylist(c *middleware.Context) { ...@@ -26,6 +26,18 @@ func ValidateOrgPlaylist(c *middleware.Context) {
c.JsonApiErr(403, "You are not allowed to edit/view playlist", nil) c.JsonApiErr(403, "You are not allowed to edit/view playlist", nil)
return 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 { func SearchPlaylists(c *middleware.Context) Response {
......
...@@ -233,6 +233,7 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error { ...@@ -233,6 +233,7 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
"DELETE FROM dashboard_tag WHERE dashboard_id = ? ", "DELETE FROM dashboard_tag WHERE dashboard_id = ? ",
"DELETE FROM star WHERE dashboard_id = ? ", "DELETE FROM star WHERE dashboard_id = ? ",
"DELETE FROM dashboard WHERE id = ?", "DELETE FROM dashboard WHERE id = ?",
"DELETE FROM playlist_item WHERE type = 'dashboard_by_id' AND value = ?",
} }
for _, sql := range deletes { for _, sql := range deletes {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment