]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/subscribe.php
Merge branch 'social-master' into rewrites-master/type-hints-asserts
[quix0rs-gnu-social.git] / actions / subscribe.php
index 36f9fc724b53a1c552e02b7075a849a44591d640..1da061819baf835b90d10610127e780fad3ca2a2 100644 (file)
@@ -64,7 +64,7 @@ class SubscribeAction extends Action
      *
      * @return boolean success flag
      */
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -74,7 +74,6 @@ class SubscribeAction extends Action
             // TRANS: Client error displayed trying to perform any request method other than POST.
             // TRANS: Do not translate POST.
             $this->clientError(_('This action only accepts POST requests.'));
-            return false;
         }
 
         // CSRF protection
@@ -85,7 +84,6 @@ class SubscribeAction extends Action
             // TRANS: Client error displayed when the session token is not okay.
             $this->clientError(_('There was a problem with your session token.'.
                                  ' Try again, please.'));
-            return false;
         }
 
         // Only for logged-in users
@@ -95,7 +93,6 @@ class SubscribeAction extends Action
         if (empty($this->user)) {
             // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
             $this->clientError(_('Not logged in.'));
-            return false;
         }
 
         // Profile to subscribe to
@@ -107,7 +104,6 @@ class SubscribeAction extends Action
         if (empty($this->other)) {
             // TRANS: Client error displayed trying to subscribe to a non-existing profile.
             $this->clientError(_('No such profile.'));
-            return false;
         }
 
         return true;
@@ -122,11 +118,11 @@ class SubscribeAction extends Action
      *
      * @return void
      */
-    function handle($args)
+    function handle(array $args=array())
     {
         // Throws exception on error
 
-        $sub = Subscription::start($this->user->getProfile(),
+        $sub = Subscription::ensureStart($this->user->getProfile(),
                                    $this->other);
 
         if ($this->boolean('ajax')) {