fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-10-25 11:54 am

[dw-free] fix warnings from reading page with multiple feed entries

[commit: http://hg.dwscoalition.org/dw-free/rev/78543b79f924]

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

Convert the time string to a number.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Logic/LogItems.pm
--------------------------------------------------------------------------------
diff -r e23da908d160 -r 78543b79f924 cgi-bin/DW/Logic/LogItems.pm
--- a/cgi-bin/DW/Logic/LogItems.pm	Tue Oct 25 19:37:10 2011 +0800
+++ b/cgi-bin/DW/Logic/LogItems.pm	Tue Oct 25 19:53:22 2011 +0800
@@ -280,6 +280,8 @@
 
             $itemsleft--;
 
+            my $evtime = sub { LJ::mysqldate_to_time( $_[0]->{eventtime} ) };
+
             # sort all the total items by rlogtime (recent at beginning).
             # if there's an in-second tie, the "newer" post is determined by
             # the later eventtime (if known/different from rlogtime), then by
@@ -287,7 +289,7 @@
             # the same journal, but means everything if they are (which happens
             # almost never for a human, but all the time for RSS feeds)
             @items = sort { $a->{rlogtime}  <=> $b->{rlogtime}  ||
-                            $b->{eventtime} <=> $a->{eventtime} ||
+                            $evtime->($b)   <=> $evtime->($a) ||
                             $b->{jitemid}   <=> $a->{jitemid}     } @items;
 
             # cut the list down to what we need.
@@ -615,7 +617,7 @@
 
     my $entryids = $u->selectcol_arrayref(
         q{SELECT DISTINCT nodeid FROM talk2
-          WHERE journalid = ? AND state NOT IN ('D', 'S') 
+          WHERE journalid = ? AND state NOT IN ('D', 'S')
           ORDER BY jtalkid DESC LIMIT 10},
         undef, $u->id
     );
--------------------------------------------------------------------------------