X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapifriendshipsdestroy.php;h=d48a577562af968e259899c56e5a32edb8a79933;hb=a21a17263956808e074fb62551300c5d6297387b;hp=fb73624c9aab05242c168861ec1ca36dd9e814d6;hpb=691beefd0f3755bab195279b1c0d7cc583942b72;p=quix0rs-gnu-social.git diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php index fb73624c9a..d48a577562 100644 --- a/actions/apifriendshipsdestroy.php +++ b/actions/apifriendshipsdestroy.php @@ -97,7 +97,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction if (!in_array($this->format, array('xml', 'json'))) { $this->clientError( - _('API method not found!'), + _('API method not found.'), 404, $this->format ); @@ -113,23 +113,20 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction return; } - // Do not allow unsubscribing from yourself! + // Don't allow unsubscribing from yourself! if ($this->user->id == $this->other->id) { $this->clientError( - _("You cannot unfollow yourself!"), + _("You cannot unfollow yourself."), 403, $this->format ); return; } - $result = subs_unsubscribe_user($this->user, $this->other->nickname); - - if (is_string($result)) { - $this->clientError($result, 403, $this->format); - return; - } + // throws an exception on error + Subscription::cancel($this->user->getProfile(), + $this->other->getProfile()); $this->initDocument($this->format); $this->showProfile($this->other, $this->format);