vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r18313: LJSUP-7966: Brenden's Notes show through...

Committer: vad
LJSUP-7966: Brenden's Notes show through on Featured Post widget
U   trunk/cgi-bin/LJ/TopEntries.pm
Modified: trunk/cgi-bin/LJ/TopEntries.pm
===================================================================
--- trunk/cgi-bin/LJ/TopEntries.pm	2011-02-16 03:52:52 UTC (rev 18312)
+++ trunk/cgi-bin/LJ/TopEntries.pm	2011-02-16 05:07:20 UTC (rev 18313)
@@ -149,7 +149,12 @@
             url         => $entry->url(),
             time        => $entry->logtime_unix(),
             userpic     => $userpic->url(),
-            poster      => $poster->ljuser_display(),
+
+            ## Do not store results of ljuser_display() anywhere
+            ## becouse they depend on $remote user.
+            ## this field should be generated on fly.
+            #  poster      => $poster->ljuser_display(),
+
             timestamp   => $timestamp,
 
             comments    => $entry->reply_count,
@@ -263,12 +268,22 @@
         $self->{featured_posts} = $struct->{spots} || [];
         $self->{timelimit}      = $struct->{timelimit};
 
+        my $users = {};
+        $users = LJ::load_userids( map {$_->{posterid} } @{ $self->{featured_posts} } )
+            if ref $self->{featured_posts} eq 'ARRAY';
+
         ## Update comments couter
         foreach my $spot (@{ $self->{featured_posts} }){
             my $entry = LJ::Entry->new($spot->{journalid}, jitemid => $spot->{jitemid});
             next unless $entry;
+            
+            my $u = $users->{$spot->{posterid}};
+            next unless $u;
+
             $spot->{comments} = $entry->reply_count();
             $spot->{logtime}  = $spot->{time} = $entry->logtime_unix();
+
+            $spot->{poster}   = $u->ljuser_display();
         }
     }
     $self->{min_entries} ||= 3;

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