X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigroupshow.php;h=5745a81f4172e6572694bba3b12ccb1ea638f8ed;hb=c6f09306b1c72296db8b55500a5d6a2ea8cd5dd2;hp=aae4d249c3e8ecb9cd80ee416b55288091425afb;hpb=d32af91f25d219761badde84f5a7ffe63be6b0b1;p=quix0rs-gnu-social.git diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index aae4d249c3..5745a81f41 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -45,6 +45,7 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @author Evan Prodromou * @author Jeffery To * @author Zach Copley + * @author Michele * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -68,6 +69,24 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->group = $this->getTargetGroup($this->arg('id')); + if (empty($this->group)) { + $alias = Group_alias::staticGet( + 'alias', + common_canonical_nickname($this->arg('id')) + ); + if (!empty($alias)) { + $args = array('id' => $alias->group_id, 'format' => $this->format); + common_redirect(common_local_url('ApiGroupShow', $args), 301); + } else { + $this->clientError( + _('Group not found!'), + 404, + $this->format + ); + } + return; + } + return true; } @@ -85,15 +104,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction { parent::handle($args); - if (empty($this->group)) { - $this->clientError( - _('Group not found!'), - 404, - $this->format - ); - return; - } - switch($this->format) { case 'xml': $this->showSingleXmlGroup($this->group); @@ -102,10 +112,9 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->showSingleJsonGroup($this->group); break; default: - $this->clientError(_('API method not found!'), 404, $this->format); + $this->clientError(_('API method not found.'), 404, $this->format); break; } - } /** @@ -149,4 +158,19 @@ class ApiGroupShowAction extends ApiPrivateAuthAction return null; } + /** + * Return true if read only. + * + * MAY override + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + + function isReadOnly($args) + { + return true; + } + }