<?php namespace BookStack\Http\Controllers;
-use BookStack\Repos\CommentRepo;
-use BookStack\Repos\EntityRepo;
+use Activity;
+use BookStack\Actions\CommentRepo;
+use BookStack\Entities\Repos\EntityRepo;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
/**
* CommentController constructor.
- * @param EntityRepo $entityRepo
- * @param CommentRepo $commentRepo
+ * @param \BookStack\Entities\Repos\EntityRepo $entityRepo
+ * @param \BookStack\Actions\CommentRepo $commentRepo
*/
public function __construct(EntityRepo $entityRepo, CommentRepo $commentRepo)
{
// Create a new comment.
$this->checkPermission('comment-create-all');
- $comment = $this->commentRepo->create($page, $request->all());
- return view('comments/comment', ['comment' => $comment]);
+ $comment = $this->commentRepo->create($page, $request->only(['html', 'text', 'parent_id']));
+ Activity::add($page, 'commented_on', $page->book->id);
+ return view('comments.comment', ['comment' => $comment]);
}
/**
$this->checkOwnablePermission('page-view', $comment->entity);
$this->checkOwnablePermission('comment-update', $comment);
- $comment = $this->commentRepo->update($comment, $request->all());
- return view('comments/comment', ['comment' => $comment]);
+ $comment = $this->commentRepo->update($comment, $request->only(['html', 'text']));
+ return view('comments.comment', ['comment' => $comment]);
}
/**