]> BookStack Code Mirror - bookstack/blobdiff - app/Repos/CommentRepo.php
Update/fix german translation
[bookstack] / app / Repos / CommentRepo.php
index 83847239f1be6e10bb45992b17aa87e3b2ae6c5b..ce71b923498ac0ed376ac25ab154f42852ddfb2b 100644 (file)
@@ -31,10 +31,26 @@ class CommentRepo {
         return $comment;
     }
 
-    public function update($comment, $input) {
+    public function update($comment, $input, $activeOnly = true) {
         $userId = user()->id;
         $comment->updated_by = $userId;
         $comment->fill($input);
+
+        // only update active comments by default.
+        $whereClause = ['active' => 1];
+        if (!$activeOnly) {
+            $whereClause = [];
+        }
+        $comment->update($whereClause);
+        return $comment;
+    }
+
+    public function delete($comment) {
+        $comment->text = trans('entities.comment_deleted');
+        $comment->html = trans('entities.comment_deleted');
+        $comment->active = false;
+        $userId = user()->id;
+        $comment->updated_by = $userId;
         $comment->save();
         return $comment;
     }