]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/subqueue.php
Added more checked type-hints.
[quix0rs-gnu-social.git] / actions / subqueue.php
index 38bc16e56236d28e1acdc471e07977ebab1961f2..c87202ddf1cc602ff8bc996c61d435c3824cc1cf 100644 (file)
@@ -44,23 +44,15 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
  */
 class SubqueueAction extends GalleryAction
 {
-    var $page = null;
+    protected $needLogin = true;
 
-    function isReadOnly($args)
-    {
-        return true;
-    }
-
-    // @todo FIXME: most of this belongs in a base class, sounds common to most group actions?
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
 
-        $cur = common_current_user();
-        if (!$cur || $cur->id != $this->profile->id) {
+        if ($this->scoped->id != $this->target->id) {
             // TRANS: Client error displayed when trying to approve group applicants without being a group administrator.
             $this->clientError(_('You may only approve your own pending subscriptions.'));
-            return false;
         }
         return true;
     }
@@ -71,12 +63,12 @@ class SubqueueAction extends GalleryAction
             // TRANS: Title of the first page showing pending subscribers still awaiting approval.
             // TRANS: %s is the name of the user.
             return sprintf(_('%s subscribers awaiting approval'),
-                           $this->profile->nickname);
+                           $this->target->getNickname());
         } else {
             // TRANS: Title of all but the first page showing pending subscribersmembers still awaiting approval.
             // TRANS: %1$s is the name of the user, %2$d is the page number of the members list.
             return sprintf(_('%1$s subscribers awaiting approval, page %2$d'),
-                           $this->profile->nickname,
+                           $this->target->getNickname(),
                            $this->page);
         }
     }
@@ -96,7 +88,7 @@ class SubqueueAction extends GalleryAction
 
         $cnt = 0;
 
-        $members = $this->profile->getRequests($offset, $limit);
+        $members = $this->target->getRequests($offset, $limit);
 
         if ($members) {
             // @fixme change!
@@ -108,13 +100,13 @@ class SubqueueAction extends GalleryAction
 
         $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
                           $this->page, 'subqueue',
-                          array('nickname' => $this->profile->nickname)); // urgh
+                          array('nickname' => $this->target->getNickname())); // urgh
     }
 }
 
 class SubQueueList extends ProfileList
 {
-    function newListItem($profile)
+    function newListItem(Profile $profile)
     {
         return new SubQueueListItem($profile, $this->action);
     }