]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make get_group() behave more like get_user()
authorZach Copley <zach@controlyourself.ca>
Sat, 11 Jul 2009 01:22:19 +0000 (18:22 -0700)
committerZach Copley <zach@controlyourself.ca>
Sat, 11 Jul 2009 01:22:19 +0000 (18:22 -0700)
lib/router.php
lib/twitterapi.php

index cd2143d131056f7e9b7f5728fa8c9e6366d0c6ec..8104d7818c0518db5f8bee4859de486964462937 100644 (file)
@@ -399,6 +399,10 @@ class Router
                     array('action' => 'api',
                           'apiaction' => 'groups'));
 
+        $m->connect('api/laconica/groups/:method',
+                    array('action' => 'api',
+                          'apiaction' => 'groups'));
+
         // search
         $m->connect('api/search.atom', array('action' => 'twitapisearchatom'));
         $m->connect('api/search.json', array('action' => 'twitapisearchjson'));
index d2515070dbacef0b316303101804aea273951271..4f3a5c0b6f0e4fdb9fc13160cc5662c2085330c2 100644 (file)
@@ -779,19 +779,19 @@ class TwitterapiAction extends Action
         if (empty($id)) {
 
             if (is_numeric($this->arg('id'))) {
-                return User::staticGet($this->arg('id'));
+                return User_group::staticGet($this->arg('id'));
             } else if ($this->arg('id')) {
                 $nickname = common_canonical_nickname($this->arg('id'));
                 return User_group::staticGet('nickname', $nickname);
-            } else if ($this->arg('user_id')) {
+            } else if ($this->arg('group_id')) {
                 // This is to ensure that a non-numeric user_id still
                 // overrides screen_name even if it doesn't get used
-                if (is_numeric($this->arg('user_id'))) {
-                    return User_group::staticGet('id', $this->arg('user_id'));
+                if (is_numeric($this->arg('group_id'))) {
+                    return User_group::staticGet('id', $this->arg('group_id'));
                 }
-            } else if ($this->arg('screen_name')) {
-                $nickname = common_canonical_nickname($this->arg('screen_name'));
-                return User::staticGet('nickname', $nickname);
+            } else if ($this->arg('group_name')) {
+                $nickname = common_canonical_nickname($this->arg('group_name'));
+                return User_group::staticGet('nickname', $nickname);
             }
 
         } else if (is_numeric($id)) {