Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Commit

Permalink
Get rid of some more validation exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke committed Sep 11, 2014
1 parent 2273af8 commit 82d3058
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
6 changes: 1 addition & 5 deletions src/FluxBB/Actions/EditPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace FluxBB\Actions;

use Carbon\Carbon;
use FluxBB\Actions\Exception\ValidationException;
use FluxBB\Validator\PostValidator;
use FluxBB\Server\Request;
use FluxBB\Models\User;
Expand All @@ -24,7 +23,6 @@ public function __construct(PostValidator $validator)
/**
* Run the action and return a response for the user.
*
* @throws Exception\ValidationException
* @return void
*/
protected function run()
Expand All @@ -41,9 +39,7 @@ protected function run()
'edited_by' => $creator->username,
]);

if (! $this->validator->isValid($this->post)) {
throw new ValidationException();
}
$this->validator->validate($this->post);

$this->post->save();
$this->trigger('post.edited', [$this->post, $creator]);
Expand Down
3 changes: 0 additions & 3 deletions src/FluxBB/Actions/NewTopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace FluxBB\Actions;

use Carbon\Carbon;
use FluxBB\Actions\Exception\ValidationException;
use FluxBB\Validator\PostValidator;
use FluxBB\Server\Request;
use FluxBB\Models\User;
Expand All @@ -30,7 +29,6 @@ public function __construct(PostValidator $validator)
/**
* Run the action and return a response for the user.
*
* @throws Exception\ValidationException
* @return void
*/
protected function run()
Expand Down Expand Up @@ -58,7 +56,6 @@ protected function run()
]);

$this->onErrorRedirectTo(new Request('new_topic', ['id' => $this->forum->id]));

$this->validator->validate($this->post);

$this->topic->save();
Expand Down
6 changes: 1 addition & 5 deletions src/FluxBB/Actions/Reply.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace FluxBB\Actions;

use Carbon\Carbon;
use FluxBB\Actions\Exception\ValidationException;
use FluxBB\Validator\PostValidator;
use FluxBB\Server\Request;
use FluxBB\Models\User;
Expand All @@ -27,7 +26,6 @@ public function __construct(PostValidator $validator)
/**
* Run the action and return a response for the user.
*
* @throws Exception\ValidationException
* @return void
*/
protected function run()
Expand All @@ -45,9 +43,7 @@ protected function run()
]);

$this->onErrorRedirectTo(new Request('viewtopic', ['id' => $this->topic->id]));
if (! $this->validator->isValid($this->post)) {
throw new ValidationException();
}
$this->validator->validate($this->post);

$this->topic->addReply($this->post);
$this->post->save();
Expand Down

0 comments on commit 82d3058

Please sign in to comment.