]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apifriendshipscreate.php
Group logos would not be fetched
[quix0rs-gnu-social.git] / actions / apifriendshipscreate.php
index 993280981845331e8f95206f93272d33fc931737..9c410f379a08f648beb098ceb7e88564b0418989 100644 (file)
@@ -33,8 +33,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/apiauth.php';
-
 /**
  * Allows the authenticating users to follow (subscribe) the user specified in
  * the ID parameter.  Returns the befriended user in the requested format when
@@ -124,11 +122,10 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
             return;
         }
 
-        $result = subs_subscribe_to($this->user, $this->other);
-
-        if (is_string($result)) {
-            $this->clientError($result, 403, $this->format);
-            return;
+        try {
+            Subscription::start($this->user->getProfile(), $this->other);
+        } catch (Exception $e) {
+            $this->clientError($e->getMessage(), 403, $this->format);
         }
 
         $this->initDocument($this->format);