Playlists: Remove API validation for empty playlists and remove redundant API call (#26982)

* Remove validation from empty playlists

* Remove redundant API call

Frontend used to call /api/playlists/:id/items directly after /api/playlists/:id but items are already included in the first response
This commit is contained in:
Sofia Papagiannaki
2020-08-14 11:59:50 +03:00
committed by GitHub
parent bb0f17ce59
commit 7ad1e3663c
2 changed files with 1 additions and 22 deletions

View File

@@ -1,8 +1,6 @@
package api
import (
"net/http"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
)
@@ -26,18 +24,6 @@ func ValidateOrgPlaylist(c *models.ReqContext) {
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.Context.Req.Method != http.MethodDelete {
c.JsonApiErr(404, "Playlist is empty", itemsErr)
return
}
}
func SearchPlaylists(c *models.ReqContext) Response {

View File

@@ -46,14 +46,7 @@ export class PlaylistEditCtrl {
.get('/api/playlists/' + playlistId)
.then((result: any) => {
this.playlist = result;
})
);
promiseToDigest(this.$scope)(
getBackendSrv()
.get('/api/playlists/' + playlistId + '/items')
.then((result: any) => {
this.playlistItems = result;
this.playlistItems = result.items;
})
);
}