From e14c88f6c52fddeeb26c71f13e93db7a8fabdd3b Mon Sep 17 00:00:00 2001 From: Eric Helgeson Date: Mon, 16 Nov 2009 14:59:32 -0500 Subject: [PATCH] Consistant error for groups that dont exist in API --- actions/apigroupismember.php | 2 +- actions/apigroupjoin.php | 2 +- actions/apigroupleave.php | 2 +- actions/apigroupmembership.php | 5 +++++ actions/apigroupshow.php | 2 +- actions/apitimelinegroup.php | 8 +++++++- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php index a822d18ddd..08348e97bd 100644 --- a/actions/apigroupismember.php +++ b/actions/apigroupismember.php @@ -92,7 +92,7 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction } if (empty($this->group)) { - $this->clientError('Group not found!', 404, $this->format); + $this->clientError(_('Group not found!'), 404, $this->format); return false; } diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php index ffda3986ff..b531d95015 100644 --- a/actions/apigroupjoin.php +++ b/actions/apigroupjoin.php @@ -101,7 +101,7 @@ class ApiGroupJoinAction extends ApiAuthAction } if (empty($this->group)) { - $this->clientError('Group not found!', 404, $this->format); + $this->clientError(_('Group not found!'), 404, $this->format); return false; } diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index 8665ea1aa8..514a3a557d 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -101,7 +101,7 @@ class ApiGroupLeaveAction extends ApiAuthAction } if (empty($this->group)) { - $this->clientError('Group not found!', 404, $this->format); + $this->clientError(_('Group not found!'), 404, $this->format); return false; } diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index d221a64183..dd2843161a 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -87,6 +87,11 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction { parent::handle($args); + if (empty($this->group)) { + $this->clientError(_('Group not found!'), 404, $this->format); + return false; + } + // XXX: RSS and Atom switch($this->format) { diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index b745ff92f6..f9b960747b 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -87,7 +87,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction if (empty($this->group)) { $this->clientError( - 'Group not found!', + _('Group not found!'), 404, $this->format ); diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index f25f6ba513..de13e7eb98 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -69,7 +69,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction parent::prepare($args); $this->group = $this->getTargetGroup($this->arg('id')); - $this->notices = $this->getNotices(); return true; } @@ -87,6 +86,13 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction function handle($args) { parent::handle($args); + + if (empty($this->group)) { + $this->clientError(_('Group not found!'), 404, $this->format); + return false; + } + + $this->notices = $this->getNotices(); $this->showTimeline(); }