mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 17:26:43 +00:00
Update CommentController
This commit is contained in:
parent
d3860fdbb3
commit
dba78c24cc
1 changed files with 9 additions and 1 deletions
|
@ -9,6 +9,14 @@ use App\{Comment, Profile, Status};
|
||||||
|
|
||||||
class CommentController extends Controller
|
class CommentController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function show(Request $request, $username, int $id)
|
||||||
|
{
|
||||||
|
$user = Profile::whereUsername($username)->firstOrFail();
|
||||||
|
$status = Status::whereProfileId($user->id)->whereNotNull('in_reply_to_id')->findOrFail($id);
|
||||||
|
return view('status.reply', compact('user', 'status'));
|
||||||
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
if(Auth::check() === false) { abort(403); }
|
if(Auth::check() === false) { abort(403); }
|
||||||
|
@ -34,7 +42,7 @@ class CommentController extends Controller
|
||||||
NewStatusPipeline::dispatch($reply, false);
|
NewStatusPipeline::dispatch($reply, false);
|
||||||
|
|
||||||
if($request->ajax()) {
|
if($request->ajax()) {
|
||||||
$response = ['code' => 200, 'msg' => 'Comment saved'];
|
$response = ['code' => 200, 'msg' => 'Comment saved', 'username' => $profile->username, 'url' => $reply->url(), 'profile' => $profile->url()];
|
||||||
} else {
|
} else {
|
||||||
$response = redirect($status->url());
|
$response = redirect($status->url());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue