|
@@ 47-55 (lines=9) @@
|
| 44 |
|
|
| 45 |
|
$newForm = new ModelForm('new-comment-form', Comment::class); |
| 46 |
|
|
| 47 |
|
if ($this->di->request->getMethod() == 'POST' && $loggedInUser) { |
| 48 |
|
$comment = $newForm->populateModel(); |
| 49 |
|
$comment->user = $loggedInUser; |
| 50 |
|
$newForm->validate(); |
| 51 |
|
if ($newForm->isValid()) { |
| 52 |
|
$this->comments->save($comment); |
| 53 |
|
$this->di->response->redirect("comment/$postid#{$comment->id}"); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
$comments = $this->getComments($postid, $loggedInUser); |
| 58 |
|
$sortBy = $this->sortBy(); |
|
@@ 89-97 (lines=9) @@
|
| 86 |
|
|
| 87 |
|
$replyForm = new ModelForm('reply-comment-form', Comment::class); |
| 88 |
|
|
| 89 |
|
if ($this->di->request->getMethod() == 'POST') { |
| 90 |
|
$comment = $replyForm->populateModel(); |
| 91 |
|
$comment->user = $loggedInUser; |
| 92 |
|
$replyForm->validate(); |
| 93 |
|
if ($replyForm->isValid()) { |
| 94 |
|
$this->comments->save($comment); |
| 95 |
|
$this->di->response->redirect("comment/$postid#{$comment->id}"); |
| 96 |
|
} |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
$comments = $this->getComments($postid, $loggedInUser); |
| 100 |
|
$sortBy = $this->sortBy(); |