madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20614: LJSUP-10495: Incorrect rules for sorting...

Committer: sbelyaev
LJSUP-10495: Incorrect rules for sorting
U   trunk/cgi-bin/LJ/DelayedEntry.pm
Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2011-11-23 14:04:05 UTC (rev 20613)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2011-11-23 14:17:13 UTC (rev 20614)
@@ -919,12 +919,12 @@
     my ( $class, $journal, $opts ) = @_;
     return [] unless $journal;
 
-    my $skip   = $opts->{'skip'} || 0;
-    my $show   = $opts->{'show'} || 0;
-    my $userid = $opts->{'userid'};
-    my $only_my = $opts->{'only_my'};
+    my $skip          = $opts->{'skip'} || 0;
+    my $show          = $opts->{'show'} || 0;
+    my $userid        = $opts->{'userid'};
+    my $only_my       = $opts->{'only_my'};
+    my $sticky_on_top = $opts->{'sticky_on_top'};
     
-
     my $dbcr = LJ::get_cluster_def_reader($journal) 
         or die "get cluster for journal failed";
 
@@ -949,10 +949,12 @@
         $sql_limit = "LIMIT $skip, $show";
     }
 
+    my $sticky_sql = $sticky_on_top ? 'is_sticky DESC, ' : '';
+
     my $journalid = $journal->userid;
     return $dbcr->selectcol_arrayref("SELECT delayedid " .
                                      "FROM delayedlog2 WHERE journalid=$journalid  $sql_poster".
-                                     "ORDER BY is_sticky DESC, revptime $sql_limit");
+                                     "ORDER BY $sticky_sql revptime ASC $sql_limit");
 }
 
 sub get_first_entry {

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