Preventing shuffling of playlists you don't own
This commit is contained in:
@ -161,6 +161,7 @@ export let getFromUri = function( element, uri ){
|
||||
if( element == 'userid' && exploded[1] == 'user' ) return exploded[2];
|
||||
if( element == 'playlistid' && exploded[3] == 'playlist' ) return exploded[4];
|
||||
if( element == 'artistid' && exploded[1] == 'artist' ) return exploded[2];
|
||||
if( element == 'artistid' && exploded[3] == 'playlist' ) return exploded[2];
|
||||
if( element == 'albumid' && exploded[1] == 'album' ) return exploded[2];
|
||||
if( element == 'trackid' && exploded[1] == 'track' ) return exploded[2];
|
||||
return null;
|
||||
|
||||
@ -56,6 +56,11 @@ const SpotifyMiddleware = (function(){
|
||||
store.dispatch( uiActions.createNotification( "Must be logged in to Spotify to do that", 'bad' ) )
|
||||
return
|
||||
}
|
||||
|
||||
if( !store.getState().spotify.me || store.getState().spotify.me.id != helpers.getFromUri('artistid',action.key) ){
|
||||
store.dispatch( uiActions.createNotification( "You can't edit a playlist you don't own", 'bad' ) )
|
||||
return
|
||||
}
|
||||
store.dispatch( spotifyActions.reorderPlaylistTracks( action.key, action.range_start, action.range_length, action.insert_before, action.snapshot_id ))
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user