[dw-free] Using a certain username in a user tag breaks Dreamwidth
[commit: http://hg.dwscoalition.org/dw-free/rev/10b29c8c082c]
http://bugs.dwscoalition.org/show_bug.cgi?id=3999
Shortcircuit if we redirect to a user which is no longer valid.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3999
Shortcircuit if we redirect to a user which is no longer valid.
Patch by
Files modified:
- cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r 63e3af5ee420 -r 10b29c8c082c cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm Mon Oct 31 13:23:18 2011 +0800
+++ b/cgi-bin/LJ/User.pm Mon Oct 31 15:55:07 2011 +0800
@@ -1019,17 +1019,25 @@
my $u = shift;
my %opts = @_;
my $hops = $opts{hops} || 5;
+ my $username;
# Traverse the renames to the final journal
if ($u) {
while ( $u->is_redirect && $hops-- > 0 ) {
my $rt = $u->prop("renamedto");
last unless length $rt;
- $u = LJ::load_user($rt);
+
+ $username = $rt;
+ $u = LJ::load_user( $rt );
+
+ # the username we renamed to is no longer a valid user
+ last unless LJ::isu( $u );
}
}
- return $u;
+ # return both the user object, and the last known renamedto username
+ # in case the user object isn't valid
+ return ( $u, $username );
}
@@ -8456,7 +8464,7 @@
# Traverse the renames to the final journal
if ($u && !$opts->{'no_follow'}) {
- $u = $u->get_renamed_user;
+ ( $u, $user ) = $u->get_renamed_user;
}
# if invalid user, link to dummy userinfo page
--------------------------------------------------------------------------------
