mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
Fixes T372: Comment counters are now updated when new comments are made.
This commit is contained in:
parent
205e034174
commit
01ebdf5ac0
1 changed files with 9 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Comment;
|
||||
use App\Track;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
|
@ -74,6 +75,13 @@ class CreateCommentCommand extends CommandBase
|
|||
$comment->$column = $this->_id;
|
||||
$comment->save();
|
||||
|
||||
// Recount the track's comments, if this is a track comment
|
||||
if ($this->_type == 'track') {
|
||||
$track = Track::find($this->_id);
|
||||
$track->comment_count = Comment::where('track_id', $this->_id)->count();
|
||||
$track->save();
|
||||
}
|
||||
|
||||
return CommandResponse::succeed(Comment::mapPublic($comment));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue