]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
permanent redirect on non-canonical nickname
authorEvan Prodromou <evan@controlyourself.ca>
Wed, 3 Dec 2008 17:46:46 +0000 (12:46 -0500)
committerEvan Prodromou <evan@controlyourself.ca>
Wed, 3 Dec 2008 17:46:46 +0000 (12:46 -0500)
darcs-hash:20081203174646-5ed1f-8f9f050a7e8c217872c283f299d790252c205920.gz

actions/showstream.php

index 38b87ad1d462627441292fa6288961183a8b3e29..4cf216566b395a3950f230b542e0ad1a9cf8ee41 100644 (file)
@@ -30,7 +30,20 @@ class ShowstreamAction extends StreamAction {
 
                parent::handle($args);
 
-               $nickname = common_canonical_nickname($this->arg('nickname'));
+        $nickname_arg = $this->arg('nickname');
+               $nickname = common_canonical_nickname($nickname_arg);
+
+        # Permanent redirect on non-canonical nickname
+
+        if ($nickname_arg != $nickname) {
+            $args = array('nickname' => $nickname);
+            if ($this->arg('page') && $this->arg('page') != 1) {
+                $args['page'] = $this->arg['page'];
+            }
+            common_redirect(common_local_url('showstream', $args), 301);
+            return;
+        }
+
                $user = User::staticGet('nickname', $nickname);
 
                if (!$user) {