kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-08-24 04:07 pm

[dw-free] clean up error logs

[commit: http://hg.dwscoalition.org/dw-free/rev/eff8e6b23f38]

http://bugs.dwscoalition.org/show_bug.cgi?id=2812

Back out changeset 92e96536bf99.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/S2/EntryPage.pm
--------------------------------------------------------------------------------
diff -r cf96fb20414f -r eff8e6b23f38 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Tue Aug 24 07:05:19 2010 -0500
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Tue Aug 24 11:07:00 2010 -0500
@@ -22,6 +22,8 @@ use DW;
 use DW;
 use lib DW->home . "/src/s2";
 use S2;
+
+use Carp;
 
 sub EntryPage
 {
@@ -96,12 +98,14 @@ sub EntryPage
     my $view_num = ($view_arg =~ /(\d+)/) ? $1 : undef;
 
     my %userpic;
+    my %user;
     my $copts = {
         'flat' => $flat_mode,
         'thread' => ($get->{'thread'} >> 8),
         'page' => $get->{'page'},
         'view' => $view_num,
         'userpicref' => \%userpic,
+        'userref' => \%user,
         # user object is cached from call just made in EntryPage_entry
         'up' => LJ::load_user($s2entry->{'poster'}->{'user'}),
         'viewall' => $viewall,
@@ -127,7 +131,8 @@ sub EntryPage
         my ($self, $destlist, $srclist, $depth) = @_;
 
         foreach my $com (@$srclist) {
-            my $pu = $com->{upost};
+            my $pu = $com->{'posterid'} ? $user{$com->{'posterid'}} : undef;
+
             my $dtalkid = $com->{'talkid'} * 256 + $entry->anum;
             my $text = LJ::CleanHTML::quote_html( $com->{body}, $get->{nohtml} );
 
@@ -201,14 +206,18 @@ sub EntryPage
                 if ($pu) {
                     $poster = UserLite($pu);
                 } else {
-                    # posterid is invalid userid
-                    # we don't have the info, so fake a UserLite
+                    # I can't determine where this code is called, if it ever is?  so for now,
+                    # let's spit out a backtrace so we can figure out how this case happens.  we need
+                    # to fix it since the journal_type is wrong in some cases.
+                    # FIXME: watch logs
+                    Carp::cluck "LJ::S2::EntryPage faked a UserLite; userpost=$com->{userpost}:";
+                    
                     $poster = {
-                        _type => 'UserLite',
-                        username => undef,
-                        user => undef,
-                        name => undef,
-                        journal_type => 'P',  # best guess
+                        '_type' => 'UserLite',
+                        'username' => $com->{'userpost'},
+                        'user' => $com->{'userpost'},
+                        'name' => $com->{'userpost'},  # we don't have this, so fake it
+                        'journal_type' => 'P',         # fake too, but only people can post, so correct
                     };
                 }
             }
--------------------------------------------------------------------------------