UsergroupbyidAction now extends ManagedAction

This commit is contained in:
Mikael Nordfeldth 2015-07-21 02:32:17 +02:00
parent 7ce32619cc
commit 266b032b17
1 changed files with 5 additions and 36 deletions

View File

@ -42,53 +42,22 @@ if (!defined('GNUSOCIAL')) { exit(1); }
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class GroupbyidAction extends Action class GroupbyidAction extends ManagedAction
{ {
/** group we're viewing. */ /** group we're viewing. */
var $group = null; protected $group = null;
/**
* Is this page read-only?
*
* @return boolean true
*/
function isReadOnly($args) function isReadOnly($args)
{ {
return true; return true;
} }
function prepare($args) protected function doPreparation()
{ {
parent::prepare($args); $this->group = User_group::getByID($this->arg('id'));
$id = $this->arg('id');
if (!$id) {
// TRANS: Client error displayed referring to a group's permalink without providing a group ID.
$this->clientError(_('No ID.'));
}
common_debug("Got ID $id");
$this->group = User_group::getKV('id', $id);
if (!$this->group) {
// TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
$this->clientError(_('No such group.'), 404);
}
return true;
} }
/** public function showPage()
* Handle the request
*
* Shows a profile for the group, some controls, and a list of
* group notices.
*
* @return void
*/
function handle($args)
{ {
common_redirect($this->group->homeUrl(), 303); common_redirect($this->group->homeUrl(), 303);
} }