]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make lists work in single-user mode
authorEvan Prodromou <evan@status.net>
Thu, 29 Sep 2011 16:29:12 +0000 (12:29 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 29 Sep 2011 16:29:12 +0000 (12:29 -0400)
Added routes to the router for list pages in single-user mode.

For each of the actions in those routes, use the global single-user
nickname rather than a nickname URL argument to determine the tagger ID.

In nav, and for Ajax, provide the right nicknames.

actions/editpeopletag.php
actions/peopletagged.php
actions/peopletagsbyuser.php
actions/peopletagsforuser.php
actions/peopletagsubscribers.php
actions/peopletagsubscriptions.php
actions/showprofiletag.php
lib/action.php
lib/peopletaggroupnav.php
lib/router.php

index b2dedc890f6c6429d25e7a9b0f9232a012990ea3..546d9910ba1dd23239f05248e76c4582cef1fd92 100644 (file)
@@ -71,7 +71,11 @@ class EditpeopletagAction extends Action
         }
 
         $id = $this->arg('id');
-        $tagger_arg = $this->arg('tagger');
+        if (common_config('singleuser', 'enabled')) {
+            $tagger_arg = User::singleUserNickname();
+        } else {
+            $tagger_arg = $this->arg('tagger');
+        }
         $tag_arg = $this->arg('tag');
 
         $tagger = common_canonical_nickname($tagger_arg);
index 424bf2dcbe3fc59eec5afc3835f10f1c75d42aef..6f9748c234f6c269e15edd60ec95dfc16736d83e 100644 (file)
@@ -58,7 +58,12 @@ class PeopletaggedAction extends Action
         parent::prepare($args);
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
-        $tagger_arg = $this->arg('tagger');
+        if (common_config('singleuser', 'enabled')) {
+            $tagger_arg = User::singleUserNickname();
+        } else {
+            $tagger_arg = $this->arg('tagger');
+        }
+
         $tag_arg = $this->arg('tag');
         $tagger = common_canonical_nickname($tagger_arg);
         $tag = common_canonical_tag($tag_arg);
index dc3e50b9f2075b9f193a6878c45a51bc0cfd10d2..8ef1a56ee15eed415461796751064702e61a761c 100644 (file)
@@ -76,7 +76,12 @@ class PeopletagsbyuserAction extends Action
             $this->args['public'] = $this->args['private'] = false;
         }
 
-        $nickname_arg = $this->arg('nickname');
+        if (common_config('singleuser', 'enabled')) {
+            $nickname_arg = User::singleUserNickname();
+        } else {
+            $nickname_arg = $this->arg('nickname');
+        }
+
         $nickname = common_canonical_nickname($nickname_arg);
 
         // Permanent redirect on non-canonical nickname
index 321dbe19a1c66cda342e0ea4401848721f860bae..d30f7321c12dca1c6fefe7c6561c0b67af33bc6a 100644 (file)
@@ -58,7 +58,12 @@ class PeopletagsforuserAction extends Action
     {
         parent::prepare($args);
 
-        $nickname_arg = $this->arg('nickname');
+        if (common_config('singleuser', 'enabled')) {
+            $nickname_arg = User::singleUserNickname();
+        } else {
+            $nickname_arg = $this->arg('nickname');
+        }
+
         $nickname = common_canonical_nickname($nickname_arg);
 
         // Permanent redirect on non-canonical nickname
index e371799efb520052610de8906bcfb8e6ea8d1307..1834a7e4ad79fd94e238d3700ab0bbefa8f67f4a 100644 (file)
@@ -58,7 +58,12 @@ class PeopletagsubscribersAction extends Action
         parent::prepare($args);
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
 
-        $tagger_arg = $this->arg('tagger');
+        if (common_config('singleuser', 'enabled')) {
+            $tagger_arg = User::singleUserNickname();
+        } else {
+            $tagger_arg = $this->arg('tagger');
+        }
+
         $tag_arg = $this->arg('tag');
         $tagger = common_canonical_nickname($tagger_arg);
         $tag = common_canonical_tag($tag_arg);
index d857fb235615bc7a32f97bc9b3ac829ef4fb7e69..c49784296914899e90dd62e43607939bba2a95a6 100644 (file)
@@ -60,7 +60,12 @@ class PeopletagsubscriptionsAction extends Action
     {
         parent::prepare($args);
 
-        $nickname_arg = $this->arg('nickname');
+        if (common_config('singleuser', 'enabled')) {
+            $nickname_arg = User::singleUserNickname();
+        } else {
+            $nickname_arg = $this->arg('nickname');
+        }
+
         $nickname = common_canonical_nickname($nickname_arg);
 
         // Permanent redirect on non-canonical nickname
index 278246c89421a7a19b245135cf7ad236a62a4840..ec1837f835866a8a78d89545c4306caaf91cd9bf 100644 (file)
@@ -44,7 +44,11 @@ class ShowprofiletagAction extends Action
     {
         parent::prepare($args);
 
-        $tagger_arg = $this->arg('tagger');
+        if (common_config('singleuser', 'enabled')) {
+            $tagger_arg = User::singleUserNickname();
+        } else {
+            $tagger_arg = $this->arg('tagger');
+        }
         $tag_arg = $this->arg('tag');
         $tagger = common_canonical_nickname($tagger_arg);
         $tag = common_canonical_tag($tag_arg);
index 18ffb5e9206b1da4d2ee4dcab424d54f66c4e0bd..d85ee25fb65377c5913f56787ae4b2accbc39ae9 100644 (file)
@@ -328,10 +328,8 @@ class Action extends HTMLOutputter // lawsuit
                 }
                 // This route isn't available in single-user mode.
                 // Not sure why, but it causes errors here.
-                if (!common_config('singleuser', 'enabled')) {
-                    $this->inlineScript('var _peopletagAC = "' .
-                                        common_local_url('peopletagautocomplete') . '";');
-                }
+                $this->inlineScript('var _peopletagAC = "' .
+                                    common_local_url('peopletagautocomplete') . '";');
                 $this->showScriptMessages();
                 // Anti-framing code to avoid clickjacking attacks in older browsers.
                 // This will show a blank page if the page is being framed, which is
index 3cfcb3cff37a47b6cb86d57d515f3c9e68b81389..70f7f5a425baf1926f154fd37e714b46e5382973 100644 (file)
@@ -79,7 +79,13 @@ class PeopletagGroupNav extends Widget
        // FIXME: we should probably pass this in
 
         $action = $this->action->trimmed('action');
-        $nickname = $this->action->trimmed('tagger');
+
+        if (common_config('singleuser', 'enabled')) {
+            $nickname = User::singleUserNickname();
+        } else {
+            $nickname = $this->action->arg('tagger');
+        }
+
         $tag = $this->action->trimmed('tag');
 
         if ($nickname) {
index c9b12ac8e7f4b14068c713c3ad11d2cf3f3e55fd..09121c561c5d9d753425fc4ca4751b34a54ccb55 100644 (file)
@@ -817,6 +817,22 @@ class Router
                         array('action' => 'getfile'),
                         array('filename' => '[A-Za-z0-9._-]+'));
 
+            // Common people-tag stuff
+
+            $m->connect('peopletag/:tag', array('action' => 'peopletag',
+                                                'tag'    => self::REGEX_TAG));
+
+            $m->connect('selftag/:tag', array('action' => 'selftag',
+                                              'tag'    => self::REGEX_TAG));
+
+            $m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
+
+            $m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
+
+            $m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
+
+            $m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
+
             // In the "root"
 
             if (common_config('singleuser', 'enabled')) {
@@ -880,6 +896,57 @@ class Router
                 $m->connect('',
                             array('action' => 'showstream',
                                   'nickname' => $nickname));
+
+                // peopletags
+
+                $m->connect('peopletags',
+                            array('action' => 'peopletagsbyuser'));
+
+                $m->connect('peopletags/private',
+                            array('action' => 'peopletagsbyuser',
+                                  'private' => 1));
+
+                $m->connect('peopletags/public',
+                            array('action' => 'peopletagsbyuser',
+                                  'public' => 1));
+
+                $m->connect('othertags',
+                            array('action' => 'peopletagsforuser'));
+
+                $m->connect('peopletagsubscriptions',
+                            array('action' => 'peopletagsubscriptions'));
+
+                $m->connect('all/:tag/subscribers',
+                            array('action' => 'peopletagsubscribers',
+                                  'tag' => self::REGEX_TAG));
+
+                $m->connect('all/:tag/tagged',
+                                array('action' => 'peopletagged',
+                                      'tag' => self::REGEX_TAG));
+
+                $m->connect('all/:tag/edit',
+                                array('action' => 'editpeopletag',
+                                      'tag' => self::REGEX_TAG));
+
+                foreach(array('subscribe', 'unsubscribe') as $v) {
+                    $m->connect('peopletag/:id/'.$v,
+                                    array('action' => $v.'peopletag',
+                                          'id' => '[0-9]{1,64}'));
+                }
+                $m->connect('user/:tagger_id/profiletag/:id/id',
+                                array('action' => 'profiletagbyid',
+                                      'tagger_id' => '[0-9]+',
+                                      'id' => '[0-9]+'));
+
+                $m->connect('all/:tag',
+                                array('action' => 'showprofiletag',
+                                      'tag' => self::REGEX_TAG));
+
+                foreach (array('subscriptions', 'subscribers') as $a) {
+                    $m->connect($a.'/:tag',
+                                array('action' => $a),
+                                array('tag' => self::REGEX_TAG));
+                }
             } else {
                 $m->connect('', array('action' => 'public'));
                 $m->connect('rss', array('action' => 'publicrss'));
@@ -904,20 +971,6 @@ class Router
 
                 // people tags
 
-                $m->connect('peopletag/:tag', array('action' => 'peopletag',
-                                                    'tag'    => self::REGEX_TAG));
-
-                $m->connect('selftag/:tag', array('action' => 'selftag',
-                                                  'tag'    => self::REGEX_TAG));
-
-                $m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
-
-                $m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
-
-                $m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
-
-                $m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
-
                 $m->connect(':nickname/peopletags',
                                 array('action' => 'peopletagsbyuser',
                                       'nickname' => Nickname::DISPLAY_FMT));