madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22695: LJSUP-13301: Main page optimization

Committer: sbelyaev
LJSUP-13301: Main page optimization
U   trunk/cgi-bin/LJ/Entry.pm
Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm	2012-08-20 08:53:43 UTC (rev 22694)
+++ trunk/cgi-bin/LJ/Entry.pm	2012-08-20 08:59:02 UTC (rev 22695)
@@ -123,17 +123,6 @@
     # save the singleton if it doesn't exist
     $singletons{$journalid}->{$jitemid} = $self;
 
-    my $link = $self->prop('repost_link');
-    if ($link) {
-        my ($journalid, $jitemid) = split(/:/, $link);
-        my $user = int($journalid) ? LJ::want_user(int($journalid)) : undef;
-        if ($user && $jitemid)
-        {        
-            my $reposted_entry = LJ::Entry->new(int($journalid), jitemid => int($jitemid));
-            $self->{'original_post_obj'} = $reposted_entry if $reposted_entry->valid;
-        }
-    }
-
     return $self;
 }
 
@@ -1569,8 +1558,24 @@
 
 sub original_post {
     my ($class) = @_;
-
-    return $class->{'original_post_obj'};
+    
+    my $loaded_prop = $class->{'original_post_obj'};
+    
+    unless ($loaded_prop) {
+        my $link = $class->prop('repost_link');
+        if ($link) {
+            my ($journalid, $jitemid) = split(/:/, $link);
+            my $user = int($journalid) ? LJ::want_user(int($journalid)) : undef;
+            if ($user && $jitemid)
+            {     
+                my $reposted_entry = LJ::Entry->new(int($journalid), jitemid => int($jitemid));
+                $loaded_prop =  $reposted_entry if $reposted_entry->valid;
+                $class->{'original_post_obj'} = $loaded_prop;
+            }
+        }
+    }
+    
+    return $loaded_prop;
 }
 
 sub repost_offer {

Tags: livejournal, madeon, pm, sbelyaev
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