Proper definition of $args array in NewgroupAction->prepare

Also, there is no need to do 'return' after throwing a ClientError
Exception. And we'll use the Action->clientError for logging benefits
until the error handling is properly done all the way to backend.
This commit is contained in:
Mikael Nordfeldth 2013-09-01 19:28:57 +02:00
parent cfa699e445
commit 83000f6f5e

View File

@ -54,20 +54,19 @@ class NewgroupAction extends FormAction
/** /**
* Prepare to run * Prepare to run
*/ */
protected function prepare($args) protected function prepare(array $args=array())
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Client error displayed trying to create a group while not logged in. // TRANS: Client error displayed trying to create a group while not logged in.
$this->clientError(_('You must be logged in to create a group.')); $this->clientError(_('You must be logged in to create a group.'), 403);
return false;
} }
// $this->scoped is the current user profile // $this->scoped is the current user profile
if (!$this->scoped->hasRight(Right::CREATEGROUP)) { if (!$this->scoped->hasRight(Right::CREATEGROUP)) {
// TRANS: Client exception thrown when a user tries to create a group while banned. // TRANS: Client exception thrown when a user tries to create a group while banned.
throw new ClientException(_('You are not allowed to create groups on this site.'), 403); $this->clientError(_('You are not allowed to create groups on this site.'), 403);
} }
return true; return true;