madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22345: LJSUP-12704: Exclude "stamp" pages when ...

Committer: sbelyaev
LJSUP-12704: Exclude "stamp" pages when clicking on "next/previous entry" links
U   trunk/cgi-bin/LJ/Entry/Repost.pm
U   trunk/cgi-bin/LJ/Entry.pm
Modified: trunk/cgi-bin/LJ/Entry/Repost.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry/Repost.pm	2012-06-28 12:33:54 UTC (rev 22344)
+++ trunk/cgi-bin/LJ/Entry/Repost.pm	2012-06-28 14:09:33 UTC (rev 22345)
@@ -298,7 +298,17 @@
     return $reposters;
 }
 
+sub is_repost {
+    my ($class, $u, $itemid) = @_;
+    my $jitemid = int($itemid / 256);
+    
+    my $props = {};
+    LJ::load_log_props2($u, [ $jitemid ], $props);
+    my $item_props = $props->{ $jitemid};
 
+    return !!$item_props->{'repost_link'};
+}
+
 sub get_list {
     my ($class, $entry, $lastrequest) = @_;
 

Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm	2012-06-28 12:33:54 UTC (rev 22344)
+++ trunk/cgi-bin/LJ/Entry.pm	2012-06-28 14:09:33 UTC (rev 22345)
@@ -2315,10 +2315,15 @@
     my $use_sticky = $opts->{'use_sticky'} && LJ::is_enabled('sticky_entries');
 
     my $itemid = $opts->{'itemid'};
-    my $jumpid = get_itemid_near2( $u,
-                                   $itemid,
-                                   'after',
-                                   { 'skip_sticky' => $use_sticky } );
+
+    my $jumpid;
+    do {
+        $jumpid = get_itemid_near2( $u,
+                                    $itemid,
+                                    'after',
+                                    { 'skip_sticky' => $use_sticky } );
+        $itemid = int($jumpid/256);
+    } while (LJ::Entry::Repost->is_repost($u, $jumpid));
     
     if (!$jumpid) {
         return undef;
@@ -2335,10 +2340,14 @@
 
     my $itemid = $opts->{'itemid'};
 
-    my $jumpid = get_itemid_near2( $u,
+    my $jumpid;
+    do {
+        $jumpid = get_itemid_near2( $u,
                                    $itemid,
                                    'before',
                                    { 'skip_sticky' => $use_sticky });
+        $itemid = int($jumpid/256);
+    } while (LJ::Entry::Repost->is_repost($u, $jumpid));
     if (!$jumpid) {
         return undef;
     }

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