]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/cancelsubscription.php
Merge branch 'inbound-linkback' into 'master'
[quix0rs-gnu-social.git] / actions / cancelsubscription.php
index ece50375428c637ede2724489efe9e406dd187d0..16654ea020b9e3c122239e5fd99a1ba986ba8b92 100644 (file)
@@ -43,20 +43,16 @@ class CancelsubscriptionAction extends FormAction
 {
     protected $needPost = true;
 
-    protected function prepare(array $args=array())
+    protected function doPreparation()
     {
-        parent::prepare($args);
-
         $profile_id = $this->int('unsubscribeto');
         $this->target = Profile::getKV('id', $profile_id);
         if (!$this->target instanceof Profile) {
             throw new NoProfileException($profile_id);
         }
-
-        return true;
     }
 
-    protected function handlePost()
+    protected function doPost()
     {
         try {
             $request = Subscription_queue::pkeyGet(array('subscriber' => $this->scoped->id,
@@ -68,7 +64,7 @@ class CancelsubscriptionAction extends FormAction
             common_debug('Tried to cancel a non-existing pending subscription');
         }
 
-        if (StatusNet::isAjax()) {
+        if (GNUsocial::isAjax()) {
             $this->startHTML('text/xml;charset=utf-8');
             $this->elementStart('head');
             // TRANS: Title after unsubscribing from a group.
@@ -80,10 +76,7 @@ class CancelsubscriptionAction extends FormAction
             $this->elementEnd('body');
             $this->endHTML();
             exit();
-        } else {
-            common_redirect(common_local_url('subscriptions',
-                                             array('nickname' => $this->scoped->nickname)),
-                            303);
         }
+        common_redirect(common_local_url('subscriptions', array('nickname' => $this->scoped->getNickname())), 303);
     }
 }