madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20929: LJSUP-10432: Revomed delayed entries fro...

Committer: sbelyaev
LJSUP-10432: Revomed delayed entries from entries list.
U   trunk/cgi-bin/Apache/LiveJournal.pm
U   trunk/cgi-bin/LJ/DelayedEntry.pm
U   trunk/cgi-bin/LJ/Entry.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2012-01-18 13:49:32 UTC (rev 20928)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2012-01-19 08:08:52 UTC (rev 20929)
@@ -869,23 +869,6 @@
         } elsif ($uuri =~ m#^/pics#) {
             $mode = "ljphotoalbums";
 
-        } elsif ($uuri =~ m|^/d(\d+)\.html$|)  {
-            my $delayedid = $1;
-            my $u = LJ::load_user($user);
-            
-            unless ($u) {
-                LJ::Request->pnotes ('error' => 'baduser');
-                LJ::Request->pnotes ('remote' => LJ::get_remote());
-                return LJ::Request::NOT_FOUND;
-            }
-            
-            $ljentry = LJ::DelayedEntry->get_entry_by_id($u, $delayedid);
-            
-            if ( $GET{'mode'} eq "reply" || $GET{'replyto'} || $GET{'edit'} ) {
-                $mode = "reply";
-            } else {
-                $mode = "entry";
-            }
         } elsif ( $uuri =~ m|^/(\d\d\d\d)(?:/(\d\d)(?:/(\d\d))?)?(/?)$| ) {
             my ($year, $mon, $day, $slash) = ($1, $2, $3, $4);
 

Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2012-01-18 13:49:32 UTC (rev 20928)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2012-01-19 08:08:52 UTC (rev 20929)
@@ -8,19 +8,6 @@
 
 #common methodss
 
-sub create_from_url {
-    my ($class, $url, $opts) = @_;
-
-    if ($url =~ m!(.+)/d(\d+)\.html!) {
-        my $username = $1;
-        my $delayed_id = $2;
-        my $u = LJ::User->new_from_url($username) or return undef;
-        return LJ::DelayedEntry->get_entry_by_id($u, $delayed_id, $opts);
-    }
-
-    return undef;
-}
-
 sub is_delayed {
     return 1;
 }
@@ -145,13 +132,13 @@
     }
 
     my $now = time();
-    my $dt = DateTime->new(   year       => $req->{year},
-                              month      => $req->{mon},
-                              day        => $req->{day},
-                              hour       => $req->{hour},
-                              minute     => $req->{min},
-                              time_zone  => $req->{tz} );
-    
+    my $dt = DateTime->new( year       => $req->{year},
+                            month      => $req->{mon},
+                            day        => $req->{day},
+                            hour       => $req->{hour},
+                            minute     => $req->{min},
+                            time_zone  => $req->{tz} );
+
     my $utime       = $dt->epoch;
 
     my $allowmask   = $req->{'allowmask'}+0;

Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm	2012-01-18 13:49:32 UTC (rev 20928)
+++ trunk/cgi-bin/LJ/Entry.pm	2012-01-19 08:08:52 UTC (rev 20929)
@@ -2244,46 +2244,15 @@
 sub get_after_item_link {
     my ($u, $opts) = @_;
 
-    my $jumpid;
     my $sticky_id =  $u->get_sticky_entry_id;
-    my $use_sticky = $opts->{'use_sticky'};
+    my $use_sticky = $opts->{'use_sticky'} && LJ::is_enabled('sticky_entries');
 
     my $itemid = $opts->{'itemid'};
-    my $delayed_id = $opts->{'delayedid'};
-
-    if ($opts->{'delayedid'}) {
-        # get next delayed entry
-        my $after_id = LJ::DelayedEntry::get_itemid_after2($u, $delayed_id);
-
-        # does entry exists ?
-        if ($after_id) {
-            # append prefix to delayed entries
-            $jumpid = 'd' . $after_id;
-        } elsif ($use_sticky && $sticky_id) {
-            my $sticky_entry = LJ::Entry->new( $u, jitemid => $sticky_id);
-            if ($sticky_entry && $sticky_entry->valid) {
-                $jumpid = $sticky_entry->ditemid;
-            }
-        }
-    } elsif ($opts->{'itemid'} && $opts->{'itemid'} != $sticky_id) {
-
-        $jumpid = get_itemid_near2( $u,
-                                    $itemid,
-                                     'after',
-                                     { 'skip_sticky' => $use_sticky } );
-        LJ::DelayedEntry::get_itemid_after2($u, 0);
-        if ( !$jumpid ) {
-            my $after_id = LJ::DelayedEntry::get_first_entry($u);
-            if ($after_id) {
-                $jumpid = 'd' . $after_id;
-            } elsif ($use_sticky && $sticky_id) {
-                my $sticky_entry = LJ::Entry->new( $u, jitemid => $sticky_id);
-                if ($sticky_entry && $sticky_entry->valid) {
-                    $jumpid = $sticky_entry->ditemid;
-                }
-            }
-        }
-    }
+    my $jumpid = get_itemid_near2( $u,
+                                   $itemid,
+                                   'after',
+                                   { 'skip_sticky' => $use_sticky } );
+    
     if (!$jumpid) {
         return undef;
     }
@@ -2294,46 +2263,15 @@
 sub get_before_item_link {
     my ($u, $opts) = @_;
 
-    my $jumpid;
     my $sticky_id = $u->get_sticky_entry_id;
-    my $use_sticky = $opts->{'use_sticky'};
-    my $skip_sticky = { 'skip_sticky' => 1 };
+    my $use_sticky = $opts->{'use_sticky'} && LJ::is_enabled('sticky_entries');
 
     my $itemid = $opts->{'itemid'};
 
-    if ($opts->{'delayedid'}) {
-        my $delayed_id = $opts->{'delayedid'};
-        my $prev_id = LJ::DelayedEntry::get_itemid_before2($u, $delayed_id);
-
-        # does delayed entry exists?
-        if ($prev_id) {
-            # append prefix to delayed entries
-            $jumpid = 'd' . $prev_id;
-        } else {
-            # select usual entry
-            $jumpid = get_latest_item( $u, $skip_sticky );
-        }
-    } elsif ($opts->{itemid}) {
-        my $item_id = $opts->{itemid};
-        if ( $use_sticky && ( $item_id == $sticky_id ) ) {
-            my $prev_id = LJ::DelayedEntry::get_last_entry($u);
-            if ($prev_id) {
-                $jumpid = 'd' . $prev_id;
-            } else {
-                $jumpid = get_latest_item( $u, $skip_sticky );
-            }
-        } else {
-            $jumpid = get_itemid_near2( $u,
-                                        $item_id,
-                                        'before',
-                                        $skip_sticky );
-        }
-    } elsif ($opts->{'_preview'}) {
-        ## special case
-    } else {
-        die "Error: item id is not set at all";
-    }
-
+    my $jumpid = get_itemid_near2( $u,
+                                   $itemid,
+                                   'before',
+                                   { 'skip_stucky' => $use_sticky });
     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