fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-04 03:34 am

[dw-free] new feeds pulling in entries in reverse order

[commit: http://hg.dwscoalition.org/dw-free/rev/274654be3959]

http://bugs.dwscoalition.org/show_bug.cgi?id=2623

Order by jitemid properly as a fallback, when we are ordering by logtime and
logtime is the same. (for communities and feeds)

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Logic/LogItems.pm
--------------------------------------------------------------------------------
diff -r a8a7e3b90b3a -r 274654be3959 cgi-bin/DW/Logic/LogItems.pm
--- a/cgi-bin/DW/Logic/LogItems.pm	Fri Feb 04 00:59:00 2011 +0800
+++ b/cgi-bin/DW/Logic/LogItems.pm	Fri Feb 04 11:34:24 2011 +0800
@@ -554,7 +554,7 @@ sub recent_items
                allowmask, eventtime, logtime
         FROM log2 USE INDEX ($sort_key)
         WHERE journalid=$userid $sql_select $secwhere $jitemidwhere $securitywhere $posterwhere
-        ORDER BY journalid, $sort_key, jitemid DESC
+        ORDER BY journalid, $sort_key
         $sql_limit
     };
 
@@ -579,10 +579,13 @@ sub recent_items
     while (my $li = $sth->fetchrow_hashref) {
         push @{$args{'itemids'}}, $li->{'itemid'};
 
+        my $sortdate = { rlogtime => 'system_alldatepart',
+                         revttime => 'alldatepart' }->{$sort_key};
+
         $flush->() unless defined $last_time &&
-                          $li->{alldatepart} eq $last_time;
+                          $li->{$sortdate} eq $last_time;
         push @buf, $li;
-        $last_time = $li->{alldatepart};
+        $last_time = $li->{$sortdate};
 
         # construct an LJ::Entry singleton
         my $entry = LJ::Entry->new($userid, jitemid => $li->{itemid});
--------------------------------------------------------------------------------