forked from mirror/pixelfed
Update CommentController, increment reply count
This commit is contained in:
parent
11ce7e617d
commit
6fcbace0d8
1 changed files with 16 additions and 8 deletions
|
@ -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,14 +59,21 @@ class CommentController extends Controller
|
||||||
|
|
||||||
Cache::forget('transform:status:'.$status->url());
|
Cache::forget('transform:status:'.$status->url());
|
||||||
|
|
||||||
$autolink = Autolink::create()->autolink($comment);
|
$reply = DB::transaction(function() use($comment, $status, $profile) {
|
||||||
$reply = new Status();
|
$autolink = Autolink::create()->autolink($comment);
|
||||||
$reply->profile_id = $profile->id;
|
$reply = new Status();
|
||||||
$reply->caption = e($comment);
|
$reply->profile_id = $profile->id;
|
||||||
$reply->rendered = $autolink;
|
$reply->caption = e($comment);
|
||||||
$reply->in_reply_to_id = $status->id;
|
$reply->rendered = $autolink;
|
||||||
$reply->in_reply_to_profile_id = $status->profile_id;
|
$reply->in_reply_to_id = $status->id;
|
||||||
$reply->save();
|
$reply->in_reply_to_profile_id = $status->profile_id;
|
||||||
|
$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);
|
||||||
|
|
Loading…
Reference in a new issue