1
0
Fork 0
forked from mirror/pixelfed

Update CommentController, increment reply count

This commit is contained in:
Daniel Supernault 2019-04-13 14:44:58 -06:00
parent 11ce7e617d
commit 6fcbace0d8
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Auth; use Auth;
use DB;
use Cache; use Cache;
use App\Comment; use App\Comment;
@ -58,6 +59,7 @@ class CommentController extends Controller
Cache::forget('transform:status:'.$status->url()); Cache::forget('transform:status:'.$status->url());
$reply = DB::transaction(function() use($comment, $status, $profile) {
$autolink = Autolink::create()->autolink($comment); $autolink = Autolink::create()->autolink($comment);
$reply = new Status(); $reply = new Status();
$reply->profile_id = $profile->id; $reply->profile_id = $profile->id;
@ -67,6 +69,12 @@ class CommentController extends Controller
$reply->in_reply_to_profile_id = $status->profile_id; $reply->in_reply_to_profile_id = $status->profile_id;
$reply->save(); $reply->save();
$status->reply_count++;
$status->save();
return $reply;
});
NewStatusPipeline::dispatch($reply, false); NewStatusPipeline::dispatch($reply, false);
CommentPipeline::dispatch($status, $reply); CommentPipeline::dispatch($status, $reply);