Fixed sending empty comments

This commit is contained in:
Marcin Kurczewski 2013-11-17 14:16:52 +01:00
parent 7b473ba06f
commit 69a993c5af
2 changed files with 5 additions and 2 deletions

View file

@ -50,10 +50,11 @@ class CommentController
$post = Model_Post::locate($postId); $post = Model_Post::locate($postId);
$text = InputHelper::get('text'); if (InputHelper::get('submit'))
if (!empty($text))
{ {
$text = InputHelper::get('text');
$text = Model_Comment::validateText($text); $text = Model_Comment::validateText($text);
$comment = R::dispense('comment'); $comment = R::dispense('comment');
$comment->post = $post; $comment->post = $post;
if ($this->context->loggedIn) if ($this->context->loggedIn)

View file

@ -307,6 +307,8 @@
<div class="input-wrapper"><textarea name="text" cols="50" rows="3"></textarea></div> <div class="input-wrapper"><textarea name="text" cols="50" rows="3"></textarea></div>
</div> </div>
<input type="hidden" name="submit" value="1"/>
<div> <div>
<button name="sender" type="submit" value="preview">Preview</button>&nbsp; <button name="sender" type="submit" value="preview">Preview</button>&nbsp;
<button name="sender" type="submit" value="submit">Submit</button> <button name="sender" type="submit" value="submit">Submit</button>