X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapifriendshipscreate.php;h=3997a8b51c4161d48621e0112bb143fe7683903f;hb=bdd15cfe6340df9fd387e817352bea5f16655d0a;hp=873883c6513bd4ea8bac56c2dd2ebe79cedd5edb;hpb=220b51d8be61e9bd316567f3ad03fffdbc4b7526;p=quix0rs-gnu-social.git diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index 873883c651..3997a8b51c 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -29,9 +29,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Allows the authenticating users to follow (subscribe) the user specified in @@ -90,7 +88,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction $this->clientError(_('Could not follow user: profile not found.'), 403); } - if ($this->user->isSubscribed($this->other)) { + if ($this->scoped->isSubscribed($this->other)) { $errmsg = sprintf( // TRANS: Client error displayed when trying to follow a user that's already being followed. // TRANS: %s is the nickname of the user that is already being followed. @@ -101,9 +99,9 @@ class ApiFriendshipsCreateAction extends ApiAuthAction } try { - Subscription::start($this->user->getProfile(), $this->other); - } catch (Exception $e) { - $this->clientError($e->getMessage(), 403); + Subscription::start($this->scoped, $this->other); + } catch (AlreadyFulfilledException $e) { + $this->clientError($e->getMessage(), 409); } $this->initDocument($this->format);