mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-21 20:48:00 +01:00
Fixes #102: Tagging tracks with multiple show songs works again.
This was broken during the MySQL -> PostgreSQL migration.
This commit is contained in:
parent
d19e986a3e
commit
efea3cda2f
2 changed files with 4 additions and 4 deletions
|
@ -73,14 +73,14 @@ class EditTrackCommand extends CommandBase
|
|||
'genre_id' => 'required|exists:genres,id',
|
||||
'cover' => 'image|mimes:png,jpeg|min_width:350|min_height:350',
|
||||
'track_type_id' => 'required|exists:track_types,id|not_in:'.TrackType::UNCLASSIFIED_TRACK,
|
||||
'songs' => 'required_when:track_type,2|exists:songs,id',
|
||||
'cover_id' => 'exists:images,id',
|
||||
'album_id' => 'exists:albums,id',
|
||||
'username' => 'exists:users,username'
|
||||
];
|
||||
|
||||
if (isset($this->_input['track_type_id']) && $this->_input['track_type_id'] == 2) {
|
||||
if (isset($this->_input['track_type_id']) && $this->_input['track_type_id'] == TrackType::OFFICIAL_TRACK_REMIX) {
|
||||
$rules['show_song_ids'] = 'required|exists:show_songs,id';
|
||||
$this->_input['show_song_ids'] = json_decode($this->_input['show_song_ids']);
|
||||
}
|
||||
|
||||
$validator = \Validator::make($this->_input, $rules);
|
||||
|
@ -126,7 +126,7 @@ class EditTrackCommand extends CommandBase
|
|||
}
|
||||
|
||||
if ($track->track_type_id == TrackType::OFFICIAL_TRACK_REMIX) {
|
||||
$track->showSongs()->sync(explode(',', $this->_input['show_song_ids']));
|
||||
$track->showSongs()->sync($this->_input['show_song_ids']);
|
||||
} else {
|
||||
$track->showSongs()->sync([]);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ module.exports = angular.module('ponyfm').directive 'pfmTrackEditor', () ->
|
|||
formData.append name, value
|
||||
|
||||
if parseInt($scope.track.track_type_id) == 2
|
||||
formData.append 'show_song_ids', _.map(_.values($scope.selectedSongs), (s) -> s.id).join()
|
||||
formData.append 'show_song_ids', JSON.stringify(_.map(_.values($scope.selectedSongs), (s) -> s.id))
|
||||
|
||||
xhr.open 'POST', '/api/web/tracks/edit/' + $scope.track.id, true
|
||||
xhr.setRequestHeader 'X-XSRF-TOKEN', $.cookie('XSRF-TOKEN')
|
||||
|
|
Loading…
Reference in a new issue