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-21 01:22 pm

[dw-free] LJ::Entry->logtime_unix and LJ::Entry->modtime_unix return the same thing

[commit: http://hg.dwscoalition.org/dw-free/rev/5c1c10d3fd31]

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

modtime_unix should use the revtime prop, and fall back onto logtime_unix if
the entry has never been edited. Some refactoring to eliminate redundancy.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Entry.pm
--------------------------------------------------------------------------------
diff -r d157ea166cf2 -r 5c1c10d3fd31 cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Mon Feb 21 19:24:45 2011 +0800
+++ b/cgi-bin/LJ/Entry.pm	Mon Feb 21 21:21:31 2011 +0800
@@ -327,15 +327,7 @@ sub logtime_unix {
 
 sub modtime_unix {
     my $self = $_[0];
-    __PACKAGE__->preload_rows ([ $self ]) unless $self->{_loaded_row};
-    __PACKAGE__->preload_props([ $self ]) unless $self->{_loaded_props};
-
-    return LJ::mysqldate_to_time($self->{logtime}, 1);
-}
-
-sub revtime_unix {
-    my $self = $_[0];
-    return $self->prop( "revtime" );
+    return $self->prop( "revtime" ) || $self->logtime_unix;
 }
 
 sub security {
@@ -597,7 +589,7 @@ sub atom_entry {
     $atom_entry->title( $self->subject_text );
 
     $atom_entry->published( LJ::time_to_w3c( $self->logtime_unix, "Z" ) );
-    $atom_entry->updated( LJ::time_to_w3c( $self->revtime_unix || $self->logtime_unix, 'Z' ) );
+    $atom_entry->updated( LJ::time_to_w3c( $self->modtime_unix, 'Z' ) );
 
     my $author = XML::Atom::Person->new( Version => 1 );
     $author->name( $self->poster->name_orig );
--------------------------------------------------------------------------------