Show archived tracks by default in the track browser.

Reverts part of 995cc40a5f.
This commit is contained in:
Peter Deltchev 2016-09-11 16:52:57 -07:00
parent 995cc40a5f
commit 78c2f4f6d1

View file

@ -242,10 +242,7 @@ class TracksController extends ApiControllerBase
*/ */
private function applyFilters($query, $unknown = false) private function applyFilters($query, $unknown = false)
{ {
$has_filters = false;
if (Input::has('is_vocal')) { if (Input::has('is_vocal')) {
$has_filters = true;
$isVocal = \Input::get('is_vocal'); $isVocal = \Input::get('is_vocal');
if ($isVocal == 'true') { if ($isVocal == 'true') {
$query->whereIsVocal(true); $query->whereIsVocal(true);
@ -255,7 +252,6 @@ class TracksController extends ApiControllerBase
} }
if (Input::has('in_album')) { if (Input::has('in_album')) {
$has_filters = true;
if (Input::get('in_album') == 'true') { if (Input::get('in_album') == 'true') {
$query->whereNotNull('album_id'); $query->whereNotNull('album_id');
} else { } else {
@ -264,12 +260,10 @@ class TracksController extends ApiControllerBase
} }
if (Input::has('genres')) { if (Input::has('genres')) {
$has_filters = true;
$query->whereIn('genre_id', Input::get('genres')); $query->whereIn('genre_id', Input::get('genres'));
} }
if (Input::has('types') && !$unknown) { if (Input::has('types') && !$unknown) {
$has_filters = true;
$query->whereIn('track_type_id', Input::get('types')); $query->whereIn('track_type_id', Input::get('types'));
} }
@ -288,7 +282,6 @@ class TracksController extends ApiControllerBase
} }
if (Input::has('songs')) { if (Input::has('songs')) {
$has_filters = true;
// DISTINCT is needed here to avoid duplicate results // DISTINCT is needed here to avoid duplicate results
// when a track is associated with multiple show songs. // when a track is associated with multiple show songs.
$query->distinct(); $query->distinct();
@ -298,12 +291,6 @@ class TracksController extends ApiControllerBase
$query->whereIn('show_song_track.show_song_id', Input::get('songs')); $query->whereIn('show_song_track.show_song_id', Input::get('songs'));
} }
if (!$has_filters) {
$query->whereHas('user', function($q) {
$q->whereIsArchived(false);
});
}
return $query; return $query;
} }
} }