mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
Finish hotfix-2
This commit is contained in:
commit
fe6807ac2e
6 changed files with 46 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
public function getIndex() {
|
||||
$recentQuery = Track::summary()
|
||||
->with(['genre', 'user', 'cover', 'user.avatar'])
|
||||
->whereIsLatest(true)
|
||||
->userDetails()
|
||||
->explicitFilter()
|
||||
->published()
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLatestColumn extends Migration {
|
||||
public function up() {
|
||||
Schema::table('tracks', function($table) {
|
||||
$table->boolean('is_latest')->notNullable()->indexed();
|
||||
});
|
||||
|
||||
DB::update('
|
||||
UPDATE
|
||||
tracks
|
||||
SET
|
||||
is_latest = true
|
||||
WHERE
|
||||
(
|
||||
SELECT
|
||||
t2.id
|
||||
FROM
|
||||
(SELECT id, user_id FROM tracks WHERE published_at IS NOT NULL AND deleted_at IS NULL) AS t2
|
||||
WHERE
|
||||
t2.user_id = tracks.user_id
|
||||
ORDER BY
|
||||
created_at DESC
|
||||
LIMIT 1
|
||||
) = tracks.id
|
||||
AND
|
||||
published_at IS NOT NULL');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
Schema::table('tracks', function($table) {
|
||||
$table->dropColumn('is_latest');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -101,6 +101,9 @@
|
|||
|
||||
if ($track->published_at == null) {
|
||||
$track->published_at = new \DateTime();
|
||||
|
||||
DB::table('tracks')->whereUserId($track->user_id)->update(['is_latest' => false]);
|
||||
$track->is_latest = true;
|
||||
}
|
||||
|
||||
if (isset($this->_input['cover_id'])) {
|
||||
|
|
|
@ -80,6 +80,9 @@
|
|||
return $results;
|
||||
});
|
||||
|
||||
if (!count($trackIds))
|
||||
return [];
|
||||
|
||||
$tracks = Track::summary()
|
||||
->userDetails()
|
||||
->explicitFilter()
|
||||
|
|
|
@ -7249,7 +7249,7 @@ use Monolog\Formatter\LineFormatter;
|
|||
abstract class AbstractHandler implements HandlerInterface
|
||||
{
|
||||
protected $level = Logger::DEBUG;
|
||||
protected $bubble = false;
|
||||
protected $bubble = true;
|
||||
protected $formatter;
|
||||
protected $processors = array();
|
||||
public function __construct($level = Logger::DEBUG, $bubble = true)
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="form-row album span6" ng-class="{'has-error': errors.show_song_ids != null}">
|
||||
<div class="form-row album span6" ng-class="{'has-error': errors.album_id != null}">
|
||||
<a pfm-popup="album-selector" href="#" class="btn btn-small">
|
||||
Album:
|
||||
<strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong>
|
||||
|
|
Loading…
Reference in a new issue