mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 13:07:59 +01:00
Hidden archived artists' tracks from recent tracks
This commit is contained in:
parent
cf7bd8b9e6
commit
995cc40a5f
2 changed files with 17 additions and 0 deletions
|
@ -39,6 +39,10 @@ class DashboardController extends ApiControllerBase
|
||||||
->orderBy('published_at', 'desc')
|
->orderBy('published_at', 'desc')
|
||||||
->take(30);
|
->take(30);
|
||||||
|
|
||||||
|
$recentQuery->whereHas('user', function($q) {
|
||||||
|
$q->whereIsArchived(false);
|
||||||
|
});
|
||||||
|
|
||||||
$recentTracks = [];
|
$recentTracks = [];
|
||||||
|
|
||||||
foreach ($recentQuery->get() as $track) {
|
foreach ($recentQuery->get() as $track) {
|
||||||
|
|
|
@ -242,7 +242,10 @@ 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);
|
||||||
|
@ -252,6 +255,7 @@ 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 {
|
||||||
|
@ -260,10 +264,12 @@ 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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +288,7 @@ 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();
|
||||||
|
@ -291,6 +298,12 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue