]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/CommentController.php
Update passwords.php
[bookstack] / app / Http / Controllers / CommentController.php
index 384731f841242c8a9d8f9c49f51c3de57f190ae7..860b507623fb6b5d09cd6a2a1f1a4aea5021fc35 100644 (file)
@@ -1,7 +1,8 @@
 <?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;
 
@@ -12,8 +13,8 @@ class CommentController extends Controller
 
     /**
      * 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)
     {
@@ -51,8 +52,9 @@ class CommentController extends Controller
 
         // 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]);
     }
 
     /**
@@ -72,8 +74,8 @@ class CommentController extends Controller
         $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]);
     }
 
     /**