vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r19355: LJSUP-9152: some pages are be opened in ...

Committer: vad
LJSUP-9152: some pages are be opened in a renamed journal
U   trunk/cgi-bin/Apache/LiveJournal.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2011-06-24 03:17:36 UTC (rev 19354)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2011-06-24 06:11:46 UTC (rev 19355)
@@ -671,6 +671,18 @@
         # we have per-user favicons.
         return LJ::Request::DECLINED if $uuri eq "/favicon.ico";
 
+        # Now that we know ourselves to be at a sensible URI, redirect renamed
+        # journals. This ensures redirects work sensibly for all valid paths
+        # under a given username, without sprinkling redirects everywhere.
+        my $u = LJ::load_user($user);
+        if ($u && $u->is_renamed) {
+            my $renamedto = $u->prop('renamedto');
+            if ($renamedto ne '') {
+                my $redirect_url = ($renamedto =~ m!^https?://!) ? $renamedto : LJ::journal_base($renamedto, $vhost) . $uuri . $args_wq;
+                return redir($redirect_url, 301);
+            }
+        }
+
         # see if there is a modular handler for this URI
         my $ret = LJ::URI->handle($uuri);
         return $ret if defined $ret;
@@ -803,19 +815,6 @@
             return LJ::Request::NOT_FOUND;
         }
 
-        # Now that we know ourselves to be at a sensible URI, redirect renamed
-        # journals. This ensures redirects work sensibly for all valid paths
-        # under a given username, without sprinkling redirects everywhere.
-        my $u = LJ::load_user($user);
-        if ($u && $u->{'journaltype'} eq 'R' && $u->{'statusvis'} eq 'R') {
-            LJ::load_user_props($u, 'renamedto');
-            my $renamedto = $u->{'renamedto'};
-            if ($renamedto ne '') {
-                my $redirect_url = ($renamedto =~ m!^https?://!) ? $renamedto : LJ::journal_base($renamedto, $vhost) . $uuri . $args_wq;
-                return redir($redirect_url, 301);
-            }
-        }
-
         return $journal_view->({
             'vhost' => $vhost,
             'mode' => $mode,

Tags: livejournal, pm, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments